Return to Snippet

Revision: 16661
at August 11, 2009 13:28 by Meander365


Initial Code
<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>

Initial URL
http://www.positioniseverything.net/articles/cc-plus.html

Initial Description
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.

Initial Title
Targeting IE Using Conditional Comments and Just One Stylesheet

Initial Tags
css, ie

Initial Language
CSS