|
Internet Explorer (IE) CSS hack using underscore |
Often when developing an application I might have to stray onto the front end of an application (say the designer is on holiday or something). It goes without saying that your application should work AND look the same whatever the browser, and we all know that there are cross browser compatibility issues....
Normally I would either create a script to detect the browser type and version, and then load a browser specific version of the stylesheet.
Today tho I wandered into the '_' fix for IE. I say that its a fix for IE, as the content works as expected in FF.
It turns out that IE will read CSS values that have been prefixed with an underscore. So you can override specific settings with IE only version, like below:
2 margin-top: 100px;
3 width: 200px;
4 height: 100px;
5 background-color: green;
6 _background-color: red;
7}
8
9<div class="box">
10 This rectangle should be green on most of the browsers, except IE where it is red.
11</div>
The red background color will be ignored by everyone other than IE browsers.
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]