Created
May 1, 2011 19:26
-
-
Save nathansmith/950767 to your computer and use it in GitHub Desktop.
Force IE7 & IE8 to respect :last-child
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Heavy-handed way to force IE7 & IE8 to respect :last-child. | |
// Note: Using jQuery. Adjust to suit your library, etc. | |
// | |
// Style via... | |
// | |
// element:last-child, | |
// element.last-child { | |
// /* Style here */ | |
// } | |
// | |
// Yes, I realize this is not performant. But IE7 & IE8 | |
// suck. Those users are probably used to sluggishness. | |
function last_child() { | |
if ($.browser.msie && parseInt($.browser.version, 10) <= 8) { | |
$('*:last-child').addClass('last-child'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This CSS rule will be skipped in IE7, 8.
IE 7, 8 would skip the whole rule when there are :last-child exist.
It's better to separate into two rules, ie: