开发者

CSS2 Selectors not working on IE8

Does anyone know why the following CSS code is not working on IE8, and yet it's working on EVERY OTHER browser?

table.wrap tr:first-child td, table.wrap tr:last-child t开发者_如何学God { height:20px; }
table.wrap td:first-child, table.wrap td:last-child { width: 20px; }

I understand that IE8 does not support CSS3 features. But I don't think I'm using CSS3 here.

I sincerely appreciate your help.

Thank you so much!


See Quirksmode.org for a full compatibility chart of all CSS features across all the various browsers.

As you'll see from the link above, IE8 does not support the last-child feature.

It does support first-child, but since you've put them together in the same selector, it will throw the whole thing away because it doesn't recognise the last-child part.

Also note note that Quirksmode first-child as being buggy in IE8, so even though it is supported, you may want to be careful about using it.

To solve the problem, you might want to try an IE hack to get it to support extra CSS features.

One that looks quite good is Selectivizr. You might also want to look into Dean Edwards' ie7.js / ie8.js / ie9.js. Both of these aim to patch missing features into older versions of IE. They're not perfect, but they may resolve the problem for you.

Hope that helps.


IE isn't compatible: http://reference.sitepoint.com/css/pseudoclass-lastchild


I believe last-child is a part of css3 and not supported by IE8.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜