gpt4 book ai didi

css - 非 IE 时使用样式表

转载 作者:行者123 更新时间:2023-12-04 20:54:17 27 4
gpt4 key购买 nike

当我使用这段代码时

<!--[if IE 6]>
<link rel="stylesheet" href="ie6.css" type="text/css" />
<![endif]-->

<!--[if !IE]>
<link rel="stylesheet" href="not_ie.css" type="text/css" />
<![endif]-->

IE 6 确实正确使用了指定的样式表,但所有其他浏览器在应该使用基本上声明的样式表时会忽略这两种样式表,如果您不是 IE,请使用此样式表。

有什么想法吗?

最佳答案

not IE 条件注释有点 hack,因此与您针对 IE 时的编写方式略有不同。

<!--[if !IE]><!-->
<link rel="stylesheet" href="not_ie.css" type="text/css" />
<!--<![endif]-->

非 IE 浏览器将阅读此内容,因为它们完全忽略了条件注释,并且注释被认为已添加额外内容。 IE 会将此解读为“非 IE”条件并避免调用样式表。

关于css - 非 IE 时使用样式表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2514756/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com