gpt4 book ai didi

html - 李 :last-child doesn't seem to work in IE8

转载 作者:搜寻专家 更新时间:2023-10-31 21:53:22 25 4
gpt4 key购买 nike

下面是我的html结构

<div class="footerMenu">
<ul>
<li>Home</li>
<li>About</li>
<li>Feedback</li>
<li>Contact us</li>
</ul>
</div>

但是

.footerMenu li:last-child { } 

选择器在 IE8 中似乎不起作用。但是http://msdn.microsoft.com/en-us/library/cc351024%28VS.85%29.aspx表示支持伪选择器。对此有任何帮助!

最佳答案

你读错了。它说它在 IE8 中支持:

如果您正在查看 :first-child,它确实在 IE7 和 IE8 中得到支持,并且认为这同样适用于 :last-child...惊喜!它没有。

:first-child 是 CSS2 选择器,但是 :last-child 只是在 CSS3 中引入的,所以微软只针对 CSS2.1 兼容 IE8 ,他们可能在 IE8 之后才关心 :last-child

如果您知道您将只有四个 li 元素,那么您应该能够使用相邻的兄弟选择器来到达第四个 li:

.footerMenu li:first-child + li + li + li

关于html - 李 :last-child doesn't seem to work in IE8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10800498/

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