开发者

CSS first-child

Is it开发者_开发百科 safe to use CSS pseudo class first-child with regards to browser support and the like?

Thanks.


Depends which browser.

IE6 doesn't support it. See :first-child and :last-child:

Not supported by Explorer 6- on Windows.

Explorer 7, Safari 3.0, iCab only support :first-child.


You can support CSS2 pseudo-classes in IE5/IE6 by using Dean Edwards IE7 JS library

http://dean.edwards.name/IE7/

It's free, easy to use and highly recommended. Just put the following code in your HEAD:

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE7.js"></script>
<![endif]-->

Despite the BETA label It's never given me any problems and it solves a whole range of IE6 lameness issues.


According to w3 it's supported by all major browsers (ie, firefox, opera, chrome, safari) with the caveat that for :first-child to work in ie, a < !DOCTYPE> must be declared.


jQuery would be another option to solve this cross browser.


You can support IE6-8 with selectivizr. It works pretty well.

http://selectivizr.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜