Internet Explorer 根本不显示 CSS
我已经检查了整个文件,包括验证和嗅出丢失或不合适的字符。
我还删除了 CSS 文件中除几行之外的所有内容,并尝试了此操作。
Internet Explorer 根本不显示 CSS,而 FF、Chrome 和 Safari 都没有问题。
有人知道 IE 中可能已更改的设置或我丢失/使用的可能架构可能会导致此问题吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<meta http-equiv="content-LANGUAGE" content="EN"/>
<meta name="ROBOTS" content="ALL"/>
<meta name="revisit-after" content="14 days"/>
<meta name="resource-type" content="document"/>
<meta name="distribution" content="Global"/>
<meta name="rating" content="General"/>
<link rel="stylesheet" type="text/css" href="http://www.****************.css" />
<script .......
</head>
I have gone over the entire file including validating and sniffing out missing or out-of-place characters.
I have also removed all but a couple lines of the CSS file and tried this as well.
Internet Explorer is simply not showing CSS while FF, Chrome, and Safari all have no issues.
Anybody know of a setting in IE that may have been changed or a possible schema I am missing/using that could cause this?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<meta http-equiv="content-LANGUAGE" content="EN"/>
<meta name="ROBOTS" content="ALL"/>
<meta name="revisit-after" content="14 days"/>
<meta name="resource-type" content="document"/>
<meta name="distribution" content="Global"/>
<meta name="rating" content="General"/>
<link rel="stylesheet" type="text/css" href="http://www.****************.css" />
<script .......
</head>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您的页面上有 2 个
元素:
You have 2
<head>
elements on your page:也许是因为您的
标记中有一个额外的
标记,这让 IE 感到困惑?
如果删除它不起作用,那么我建议尝试生成一个最小的示例来演示您的问题。首先删除所有内容,但显示未应用样式的示例除外。然后删除越来越多的标头和代码,直到找到一个小示例,其中问题仍然存在,但它除了展示问题的最低限度之外没有任何其他内容。这样做的过程可能会帮助你找到自己的问题;但如果没有,那么您可以通过编辑您的问题在此处发布完整的示例,我们可以根据演示问题的实际代码提供更好的建议,而不是不包含足够信息来确定问题所在的不完整摘录。请记住发布示例的 HTML 和 CSS。
Maybe it's the fact that you have an extra
<head>
tag within your<head>
tag that's confusing IE?If removing that doesn't work, then I would recommend trying to produce a minimal example that demonstrates your problem. Start by removing all of the content, except for an example to show that the style isn't being applied. Then remove more and more of your headers and code, until you find a small example in which the problem is still present, but it has nothing other than the bare minimum to demonstrate the problem. The process of doing that might help you to find your own problem; but if not, then you can post a complete example here, by editing your question, and we can give better advice based on actual code that demonstrates the problem, as opposed to an incomplete excerpt that doesn't contain enough information to determine what's wrong. Remember to post both the HTML and CSS for your example.
您有重复的
声明。此声明应该只出现一次,并且应该是
中的第一个内容。
You have duplicate
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
declarations. This declaration should only appear once and should be the first thing in your<head>
.检查用于包含 css 文件的链接标记中的
rel
属性和type
属性。例如:
Check for
rel
attribute andtype
attributes in the link tag used to include the css file.For example:
声明 Doctype
Declare a Doctype
head 标签内有一个 head 标签,位于链接标签之前。删除它,看看是否有帮助。
You have a head tag inside your head tag, right before the link tag. Remove that and see if it helps.
显然,CSS规则仅适用于列为
text/html
http://www.w3.org/MarkUp/2004/xhtml-faq#css
这可能是问题所在吗?
Apparently, css rules only apply to documents listed as
text/html
http://www.w3.org/MarkUp/2004/xhtml-faq#css
Could this be the issue?