使用条件注释和一个样式表瞄准IE
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用条件注释和一个样式表瞄准IE相关的知识,希望对你有一定的参考价值。
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.
<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>
以上是关于使用条件注释和一个样式表瞄准IE的主要内容,如果未能解决你的问题,请参考以下文章