* css hack no longer working in ie8?
Ok so i want to make my border css only applicable to ie8 or earlier (as in not ie9 when it comes out).
purpose: so that in ie, the missing dropshadow will be replaced with a border:
the * hac开发者_如何学Pythonk doesnt seem to be working? im testing in ie8 locally...
input, textarea{
display:block;
border:none;
*border: 1px solid #000;
-moz-box-shadow: 0px 0px 1px 1px #999;
-webkit-box-shadow: 0px 0px 1px 1px #999;
box-shadow: 0px 0px 1px 1px #999;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
margin: 1px 0px 10px 0px;
font-size:12px;
color:#494949;
}
Do not use CSS hacks, use conditional comments for targeting IE versions instead.
Adding to Residuum's answer, this is the code you will need to reference the "pre IE 9" stylesheet:
<!--[if lt IE 9]>
<link href="ie-pre-9.css" rel="stylesheet" type="text/css" />
<![endif]-->
The expression in the first line states that the markup within the comment should be evaluated on all versions of Internet Explorer with a version number less than (lt
) 9. On non-Microsoft browsers, the code will be treated as comment - i.e. it will be ignored, and the extra stylesheet will not be included.
If you prefer not to create an additional stylesheet for your Internet Explorer fixes, you can instead use conditional comments to switch on/off a container around your entire page content, and the use the presence of this container to turn the fixes on/off. Example:
<!--[if lt IE 9]><div class="ie"><![endif]-->
Page content here...
<!--[if lt IE 9]></div><![endif]-->
In your main CSS file, you can now prefix any selector with .ie
to make it target only Internet Explorer with version numbers less than 9:
a { color: red; }
.ie a { color: blue; }
Add
<!--[if lt IE 9]>
<link href="/directroy/IE.css" rel="Stylesheet" type="text/css"/>
<![endif]-->
To your head tag and use this new stylesheet to define what you want IE to do.
They're called conditional comments and IE uses them to differentiate between browsers :)
there is a hack like i was looking for, just add this to the end of a css statement before the ;
\9
targets ie <=8
You really should just add a conditional stylesheet instead of adding hacks. You will thank yourself later.
精彩评论