浏览器支持 CSS :first-child 和 :last-child
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7938521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Browser support for CSS :first-child and :last-child
提问by Alex
Does anyone know which browsers/version support them?
有谁知道哪些浏览器/版本支持它们?
Is it safe to use them, or should I resort to PHP / javascript to generate first/last classes?
使用它们是否安全,还是应该使用 PHP/javascript 来生成第一个/最后一个类?
回答by Bojangles
:first-child
and :last-child
, along with complimentary compatibility chart.
:first-child
以及:last-child
免费的兼容性图表。
:first-child
is supported IE9 properly, and IE7 and IE8 sort of (see chart).
:first-child
正确支持 IE9,以及 IE7 和 IE8(见图表)。
:last-child
is supported by IE9+ only.
:last-child
仅 IE9+ 支持。
Both of them are supported well by the good browsers.
好的浏览器都很好地支持它们。
回答by Hristo
"Can I use..."should be your go to resource for these types of questions. Here's are the compatibility tables:
“我可以使用......”应该是您解决这些类型问题的资源。以下是兼容性表:
first-child
- http://caniuse.com/#feat=css-sel2
first-child
- http://caniuse.com/#feat=css-sel2
last-child
- http://caniuse.com/#feat=css-sel3
last-child
- http://caniuse.com/#feat=css-sel3
回答by Darin Dimitrov
Here's a nice tableillustrating different browser support.
这是一个很好的表格,说明了不同的浏览器支持。