IE7 CSS 分组
我有一些分组的课程。然而,在 IE7 及更低版本中,它不实现该组中的任何类。它似乎只是忽略了它们:
#subnav a,
#subnav span {
/* css here */
}
和 html:
<div id="subnav">
<ul class="depth-1">
<li class="selected">
<a href="someLink.html">Some Link</a>
</li>
<li>
<a href="anotherLink.html">Another Link</a>
</li>
<li>
<span>Header</span>
<ul class="depth-2">
<li>
<a href="google.com.au">Google</a>
</li>
</ul>
</li>
</ul>
</div>
IE7 及以下版本不支持 CSS 分组还是其他原因导致这种情况发生?
谢谢
I have some classes that are grouped. However in IE7 and lower it doesn't implement any of the classes in the group. It just seems to ignore them:
#subnav a,
#subnav span {
/* css here */
}
And the html:
<div id="subnav">
<ul class="depth-1">
<li class="selected">
<a href="someLink.html">Some Link</a>
</li>
<li>
<a href="anotherLink.html">Another Link</a>
</li>
<li>
<span>Header</span>
<ul class="depth-2">
<li>
<a href="google.com.au">Google</a>
</li>
</ul>
</li>
</ul>
</div>
Is CSS grouping not supported in IE7 and below or is something else causing this to happen?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在这里尝试一些操作:
确保此规则组位于 css 样式表的最后,以确保没有其他样式覆盖这些样式
使选择器尽可能具体,以确保元素具有针对性。因此,不要使用
#subnav a
,而是尝试使用div#subnav ul.depth-1 li.selected a
确保样式可以应用于这些特定元素。
a
和span
是内联元素,不接受所有样式。You could try a few things here:
make sure this rule group is last in the css stylesheet to ensure that no other styles are overwriting these ones
make the selectors as specific as possible, to ensure the elements are targeted. So, instead of
#subnav a
, trydiv#subnav ul.depth-1 li.selected a
make sure the styles can be applied to those particular elements.
a
andspan
are inline elements and do not accept all styles.