To target elements only in IE browsers i'll use
IE6:
* html #nav li ul {
left: -39px !important;
border: 1px solid red;
}
IE7:
*+html #nav li ul {
left: -39px! important;
}
Does anyone know how to target IE8?
To target elements only in IE browsers i'll use
IE6:
* html #nav li ul {
left: -39px !important;
border: 1px solid red;
}
IE7:
*+html #nav li ul {
left: -39px! important;
}
Does anyone know how to target IE8?
CSS style only for IE8:
Only IE8 will be Red.
first Blue: for all browsers.
Red: IE6,7,8 Only
Second Blue: IE6,7 Only
So Red = for IE8 only.
For a very complete summary of browser hacks (including Internet Explorer (IE), Safari, Chrome, iPhone, and Opera) visit this link: http://paulirish.com/2009/browser-specific-css-hacks/
There aren't any selector hacks for IE8. The best resource for this issue is http://browserhacks.com/#ie
If you want to target specific IE8 you should do comment in html
or you could use attribute hacks like:
For more info on this one check: http://www.paulirish.com/2009/browser-specific-css-hacks/
I'm not going to get in a debate about whether or not this method should be used, but this will let you set specific css attributes for IE8-9 only (note: it is not a selector, so a bit different than what you asked):
Use '\0/' after each css declaration, so:
And to build off another answer, you can do this to assign variou styles to IE6, IE7, and IE8:
source: http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/
This question is ancient but..
Right after the opening body tag..
Right before the closing body tag..
CSS..
You could do this for all IE browsers using conditional statements, OR target ALL browsers by encapsulating all content in a div with browser name + version server-side
In the light of the evolving thread, see below for a more complete answer:
IE 6
or
IE 7
or
IE 6 and 7
or
or
IE 6, 7 and 8
IE 8
or
IE 8 Standards Mode Only
IE 8,9 and 10
IE 9 only
IE 9 and above
IE 9 and 10
IE 10 only
IE 10 and above
or
IE 11 (and above..)
Javascript alternatives
Modernizr
User agent selection
The Javascript:
Adds (e.g) the below to the
html
element:Allowing very targetted CSS selectors, e.g.:
Footnote
If possible, avoid browser targeting. Identify and fix any issue(s) you identify. Support progressive enhancement and graceful degradation. With that in mind, this is an 'ideal world' scenario not always obtainable in a production environment, as such- the above should help provide some good options.
Attribution / Essential Reading
\9 doesn’t work with font-family, instead you’d need to use “\0/ !important” as Chris mentioned above, for example: