I want to make a css rule, which affects all but the opera browser, all the other browser add a css rule:
#content{left:1px;}
, (opera without this rule). the below code not worked...
<!--[if !OPERA]>
<style type="text/css">
#co开发者_高级运维ntent{left:1px;}
</style>
<![endif]-->
Conditional comments are recognized by IE only. If you need Opera-specific CSS, you will need JavaScript:
if (window.opera) {
document.getElementById('foo').style.height = '100px';
}
you can use the property you want for a selector like #content{left:1px;}
then add a css hack for opera providing the default value (or the value you want). The css hack has the following syntax: @media all and (min-width:0px) {head~body .selector {property:value;}}
an example of the previous syntax and your example could be: @media all and (min-width:0px) {head~body #content {left:0px;}}
精彩评论