CSS外部样式表无法正常工作,但是内部样式表上的CSS完全相同 [英] CSS External Style Sheet isn't working, but the exact same CSS was woking on an internal Style Sheet

查看:71
本文介绍了CSS外部样式表无法正常工作,但是内部样式表上的CSS完全相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建个人网站时,我在添加CSS样式表时遇到了问题.该样式表是本地文件(在同一文件夹中有.htm文件),称为"Rodrigo.css".

While making a personal website I've encountered a problem with adding a CSS Style Sheet. That Style Sheet was a local one (in the same folder has the .htm file) called "Rodrigo.css".

这是hrc中带有CSS的HTML链接标记:

Here is the HTML Link tag with the CSS in the hrc:

这是CSS样式表的屏幕截图(仅开头部分):

Here is a screenshot of the CSS Style Sheet (only the beginning part):

如您所见,没有HTML标记.

As you can see there are not HTML Tags.

注意:我在样式表中使用的CSS以前是在内部样式表中工作的,所以我不知道为什么它不起作用.

Note: The CSS that I'm using in the style sheet was previously in an internal style sheet and worked, so I don't know why it isn't working.

在制作网站时,我使用了w3schools教程.要专门执行此部分,请参见如何使用CSS ...使CSS不合格的三种方法".

While making the website I used the w3schools tutorials. To do this part specifically the "CSS How to... Three ways to incert CSS".

我发现了问题所在,HTML文件以某些浏览器不支持的格式编码,并且与外部样式表的格式不同.

I've found what the problem was, the HTML file was encoded in a format that wasn't supported by some browsers, and was a different format to the one of the external style sheet.

推荐答案

因此,我发现了问题所在.原来我是用UTF-8 Bom编码的(我不确定这是编码类型的名称),并且这导致浏览器和外部样式表出现问题,巫婆没有以相同的格式编码.我要标记这个遮篷解决了我的问题.

So, I've found the problem. It turned out I encoded it in UTF-8 Bom( I'm not sure that's the name of the enconding type) and that was causing problems with the browsers and the external style sheet, witch wasn't enconded in the same format. I'm going to mark this awnser had having solved my problem.

解决方案是将HTML源文件编码为UTP-8或其他受支持的文件,并将HTML和CSS源文件编码为相同格式.

The solution is enconding the HTML source file in UTP-8, or other files that are supported and enconding the HTML and CSS source files in the same format.

感谢您的支持,坚韧.

这篇关于CSS外部样式表无法正常工作,但是内部样式表上的CSS完全相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆