Bakabaka Bakabaka - 27 days ago 10
CSS Question

Is the css :target selector supported in IE9 in spite of w3schools saying it's not?

The site I have built and which I'm maintaining has divs that are visible depending on whether they are :target or not. Since w3schools has told me (http://www.w3schools.com/cssref/sel_target.asp) that no version of Internet Explorer supports the :target selector, I built a separate IE site.

Now it seems, though, that IE9 does correctly display my code. You can find the site here. It automatically forwards to the IE site for IE8 and lower now.

Can I safely use this construction for IE9, or should I have IE9 forward to the backup site as well?

Answer

Yes, IE9 is the first version of Internet Explorer to support the :target pseudo-class, so you are safe to use it with IE9

That aside, w3schools is not generally considered to be the best resource for up-to-date information. I find Can I Use... a cleaner and more comprehensive resource, as shown by the search result for :target.

You will often see people mentioning http://w3fools.com/ which explains why some people think w3schools is a bad resource. I recommend reading this and making your own mind up on continuing to use it. Personally I don't use w3shcools and prefer Can I Use... and the Mozilla Developer Network.