I have a dropdown menu which is doing something really janky in IE8 and I’m not entirely sure why. I must be missing something staring me clear in the fact as it breaks in fairly spectacular fashion, despite working fine in IE7, IE9, Firefox and Google Chrome. It even looks okay in IE6 bar a few minor glitches. But in IE8 is 100% borked!
It’s the last-child rules that is killing IE8 as it doesn’t understand last-child but also seems to forget about the other comma separated rules afterwards.
e.g.
a:last-child,a{background:red;display:block}
That gets no colour in IE8.
Just put the last child rules on lines of their own with no other comma separated rules.
Actually, it’s not a bug as such (Tommy confirmed this) but the way that browsers are supposed to handle rules that they don’t understand. They are instructed to ignore the whole rule block even in a comma separated list and if they meet a pseudo element they don’t understand they will just stop right there and go no further with that rule.
Therefore when using pseudo elements you should always use them on a single line of their own. Counter-intuitive and counter-productive I know.