Search code examples
cssinternet-explorerpseudo-class

first-child & last-child cross-browser compatibility


I realized I'm using these pseudo-classes pretty often, hence my question: In 2012, should I worry about older versions of IE and the way they would render the page? Of course I try to use them only when necessary, but they're really helpful and I would hate having to avoid them because of this.


Solution

  • Here's the thing. At the time I wrote the original answer:

    These are big companies who have large user bases, and even they are urging people to move or get nothing (or at least get basic functionality).

    According to this page by quirksmode, :first-child is supported in IE7+, but :last-child is only supported in IE9+. Which means if you are planning to use this, you should get ready to forget the older IE altogether.

    However, you can use selectivizr which gives you leverage to make these styles work for older browsers.