IE7 CSS 分组

发布于 2024-12-06 09:45:22 字数 803 浏览 1 评论 0原文

我有一些分组的课程。然而,在 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 技术交流群。

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

发布评论

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

评论(1

怎樣才叫好 2024-12-13 09:45:22

您可以在这里尝试一些操作:

  1. 确保此规则组位于 css 样式表的最后,以确保没有其他样式覆盖这些样式

  2. 使选择器尽可能具体,以确保元素具有针对性。因此,不要使用 #subnav a,而是尝试使用 div#subnav ul.depth-1 li.selected a

  3. 确保样式可以应用于这些特定元素。 aspan 是内联元素,不接受所有样式。

You could try a few things here:

  1. make sure this rule group is last in the css stylesheet to ensure that no other styles are overwriting these ones

  2. make the selectors as specific as possible, to ensure the elements are targeted. So, instead of #subnav a, try div#subnav ul.depth-1 li.selected a

  3. make sure the styles can be applied to those particular elements. a and span are inline elements and do not accept all styles.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文