/ Published in: CSS
A wrapper may be made to enclose the content of a page, and then you can write descendant CSS rules that mention that wrapper's ID or class name in the selector. But what if only IE thought that wrapper existed? Then those rules would only work for IE, while other browsers would ignore the rules completely.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<style> /* all browsers make border red */ #anyelement { border : 2px solid red; } /* all browsers see this, but only IE thinks #IEroot exists as an element and makes border blue */ #IEroot #anyelement { border-color : blue; } </style> <body> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p> <!--[if IE]> </div> <![endif]--> </body>
URL: http://www.positioniseverything.net/articles/cc-plus.html