[thelist] Tip: IE emulate pseudo-classes with css expression

Marin Gatellier billybad at belgacom.net
Tue Apr 10 04:10:51 CDT 2007


<tip type="IE emulate pseudo-classes with css expression" author="Marin 
Gatellier">
MSIE CSS expressions can be usefull to emulate pseudo-classes css support 
for IE < 7

<style type="text/css">
/*
fist child of a list has a background color
FF,Opera,Safari,IE7
*/
li:first-child {
    background-color:#FC0;;
}
</style>

<!--[if lte IE 6]>
<style type="text/css">
/*
Add support for IE5->IE6
*/
li {
    background-color:expression((this===this.parentNode.childNodes[0])?"#FC0":"transparent");
}
</style>


To keep the code valid, wrap it with conditionnal comments


More at:
http://www.gatellier.be/blog/css-pseudo-classes-internet-explorer/
http://msdn.microsoft.com/workshop/author/dhtml/overview/recalc.asp
</tip> 





More information about the thelist mailing list