IE 注释根本不渲染页面上的 css

发布于 2024-11-06 02:31:16 字数 687 浏览 0 评论 0原文

这是我的网站,它在 chrome、firefox 和 IE 9 上运行良好。当我在 IE 7 和 IE 9 上尝试时,它运行良好。 IE 8 我用于 css 的 IE 注释根本不显示。我的网站:http://www.chan-leung.com

<!--[if lt IE 9]>
        <link rel="stylesheet" href="css/ieHacks.css" type="text/css" media="screen, projection" />
    <![endif]-->

<!--[if IE 7]>
        <link rel="stylesheet" href="css/ieHacks7.css" type="text/css" media="screen, projection" />
    <![endif]-->

css文件在本地工作正常,但是当我上传到我的主机,CSS 不显示。我正在使用 IE 调试器进行浏览器测试(针对 IE)。 IE 的 F12 键。当我尝试查找 ieHacks.css & ieHacks7.css,没有显示任何内容。我不知道 ie 评论不起作用的原因是什么。

任何帮助或建议将不胜感激。

This is my website, it works fine on chrome, firefox and IE 9. When i try it on IE 7 & IE 8 the IE comments that I use for css is not showing at all. My website: http://www.chan-leung.com

<!--[if lt IE 9]>
        <link rel="stylesheet" href="css/ieHacks.css" type="text/css" media="screen, projection" />
    <![endif]-->

<!--[if IE 7]>
        <link rel="stylesheet" href="css/ieHacks7.css" type="text/css" media="screen, projection" />
    <![endif]-->

The css files works fine locally, but when i upload to my hosting, the css doesn't show. I'm using IE debugger for browser testing (for IE). The F12 key for IE. When i try to look up ieHacks.css & ieHacks7.css, nothing is showing. I'm stump as to what would be the reason why the ie comments is not working.

Any help or suggestion would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贱人配狗天长地久 2024-11-13 02:31:16

也许您的 css 文件命名不正确?

您的网站可能正在尝试使用 css/ieHacks.css 和 css/ieHacks7.css 但实际文件是 css/iehacks.css 和 css/iehacks7.css

也尝试使用绝对网址,看看它是否有区别,例如:

<!--[if lt IE 9]>
    <link rel="stylesheet" href="/css/iehacks.css" type="text/css" media="screen, projection" />
<![endif]-->

<!--[if IE 7]>
    <link rel="stylesheet" href="/css/iehacks7.css" type="text/css" media="screen, projection" />
<![endif]-->

另外,请注意,您首先要做一个更一般的作业,然后再做一个更具体的作业,这是有意的吗?第一个 css 文件以及第二个更具体的文件将应用于 ie7。

更新:

您的网站 CSS 似乎如下所示,这与您在问题中所说的不同:

<!--[if lte IE 8]>
    <link rel="stylesheet" href="css/iehacks.css" type="text/css" media="screen, projection" />
<![endif]-->
<!--[if IE 7]>
    <link rel="stylesheet" href="css/iehacks7.css" type="text/css" media="screen, projection" />
<![endif]-->
<!-- [if !IE 7]>
    <style type="text/css">
        #wrap {display:table;height:100%}
    </style>
<![endif]-->

Perhaps you have names the css files incorrectly?

You site is maybe trying to use css/ieHacks.css and css/ieHacks7.css but the actual files are css/iehacks.css and css/iehacks7.css

Also try using absolute urls and see if it makes a difference e.g:

<!--[if lt IE 9]>
    <link rel="stylesheet" href="/css/iehacks.css" type="text/css" media="screen, projection" />
<![endif]-->

<!--[if IE 7]>
    <link rel="stylesheet" href="/css/iehacks7.css" type="text/css" media="screen, projection" />
<![endif]-->

Also, just a note, you are doing a more general assignment first and another more specfic one second, was this intended? The first css file will be applied to ie7 as well as the second, more specific one.

UPDATE:

Your site css seems to be the following which isn't like you said in your question:

<!--[if lte IE 8]>
    <link rel="stylesheet" href="css/iehacks.css" type="text/css" media="screen, projection" />
<![endif]-->
<!--[if IE 7]>
    <link rel="stylesheet" href="css/iehacks7.css" type="text/css" media="screen, projection" />
<![endif]-->
<!-- [if !IE 7]>
    <style type="text/css">
        #wrap {display:table;height:100%}
    </style>
<![endif]-->
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文