I make the responsive grid using percentage. i'm using this
[class*=col-] + [class*=col-]:last-child{margin-right:0}
for find and replace the last column margin with 0, so that i have a issue with these pseudo elements, Any help on this !
I make the responsive grid using percentage. i'm using this
[class*=col-] + [class*=col-]:last-child{margin-right:0}
for find and replace the last column margin with 0, so that i have a issue with these pseudo elements, Any help on this !
IE8 不支持:last-child
。它确实支持:first-child
,但不支持:last-child
。
这是因为 IE8 被设计为支持 CSS2.1::first-child
在 CSS2.1 规范中,但:last-child
仅在 CSS3 规范中。
在许多情况下,如果您需要支持 IE8,则该问题的最佳解决方案是重构您的布局,以便您使用:first-child
使用:last-child
.
这个选项在很多情况下是一个很好的解决方案,并且对于支持 IE8 没有任何 hack,这是最好的方法,但它显然并不适合所有情况(否则他们根本不需要发明:last-child
)。您没有提供有关您的代码的足够信息,我无法知道它是否适合您,但如果是,我建议您这样做。
另一种选择是使用旧的后备解决方案,只需将一个类添加到适当的元素,并为该类设置样式而不是伪选择器。和老派的答案,但它会起作用。
继续讨论如何支持 IE8 但仍然使用:last-child
. 有很多方法可以做到这一点,但它们涉及使用 Javascript polyfills。我知道有两个脚本可以为您解决问题:
其中,Selectivizr 是较新的软件,仅影响 CSS 选择器,而 IE9.js 较旧,它试图修补各种 IE 版本中的许多错误、漏洞和缺失功能。两者都应该为您解决问题;试试看。
希望有帮助。