Here is my block of CSS:
.actual-form table {
padding: 5px 0 15px 15px;
margin: 0 0 30px 0;
display: block;
width: 100%;
background: #f9f9f9;
border-top: 1px solid #d0d0d0;
border-bottom: 1px solid #d0d0d0;
}
I only want IE 7, 8, and 9 to "see" width: 100%
What is the simplest way to accomplish this?
As well as a conditional comment could also use CSS Browser Selector http://rafael.adm.br/css_browser_selector/ as this will allow you to target specific browsers. You can then set your CSS as
This will also allow you to target specific browsers within your main stylesheet without the need for conditional comments.
Explanation: It is a Microsoft-specific media query. Using -ms-high-contrast property specific to Microsoft IE, it will only be parsed in Internet Explorer 10 or greater. I have used both the valid values of the media query, so it will be parsed by IE only, whether the user has high contrast enabled or not.
It really depends on the IE versions ... I found this excellent resource that is up to date from IE6-10:
Welcome BrowserDetect - an awesome function.
The
Object
BrowserDetect also providesversion
info so we can add specific classes - for ex.$('*').addClass('ie9');
if(BrowserDetect.version == 9)
.Good Luck....
I think for best practice you should write IE conditional statement inside the
<head>
tag that inside has a link to your special ie style sheet. This HAS TO BE after your custom css link so it overrides the latter, I have a small site so i use the same ie css for all pages.this differs from james answer as i think(personal opinion because i work with a designer team and i dont want them to touch my html files and mess up something there) you should never include styles in your html file.
A bit late on this one but this worked perfectly for me when trying to hide the background for IE6 & 7
I got this hack via: http://briancray.com/posts/target-ie6-and-ie7-with-only-1-extra-character-in-your-css/