CSS Specific for Internet Explorer 191
As much as we don't like to deal with the IE bugs, we still have to face it because your boss and visitors are still using Explorer. It gets frustrating when different versions of Explorer displays web pages differently due to the inconsistent rendering engine. We typically use IE conditional comments to fix the IE issues. But there are more ways than the conditional comments...
#1 IE Conditional Comments
IE conditional comment is probably the most commonly used to fix the IE bugs for specific versions (IE6, IE7, IE8). Below are some sample code to target different versions of Internet Explorer:
<!--[if IE 8]>= IE8<!--[if lt IE 8]>= IE7 or below<!--[if gte IE 8]>= greater than or equal to IE8
<!--[if IE 8]>
<style type="text/css">
/* css for IE 8 */
</style>
<![endif]-->
<!--[if lt IE 8]>
<link href="ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
#2 CSS Rules Specific to Explorer (IE CSS hacks)
Another option is to declare CSS rules that can only be read by Explorer. For example, add an asterisk (*) before the CSS property will target IE7 or add an underscore before the property will target IE6. However, this method is not recommended because they are not valid CSS syntax.
- IE8 or below: to write CSS rules specificially to IE8 or below, add a backslash and 9 (
\9) at the end before the semicolon. - IE7 or below: add an asterisk (
*) before the CSS property. - IE6: add an underscore (
_) before the property.
.box {
background: gray; /* standard */
background: pink\9; /* IE 8 and below */
*background: green; /* IE 7 and below */
_background: blue; /* IE 6 */
}
#3 Conditional HTML Class
The third option, which was founded by Paul Irish, is to add an CSS class with the IE version to the HTML tag by using IE conditional comments. Basicially, it checks if it is IE, then add a class to the html tag. So to target specific IE version, simply use the IE class as the parent selector (eg. .ie6 .box). This is a clever way and it doesn't cause any validation errors.
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you
This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you This is way past due…but it’s finally here: a print stylesheet!
I’ll start by showing you
Nice Tutorial. I learned a lot.
Nice Tutorial. Helful for a web designer like me.
So, if I do #3 I now have 1 more opening (‘). Surely this is bad?
OK… it chopped out some text on my message. The ‘less-thans’ do not equal the ‘greater thans’
I’ve been browsing on-line greater than three hours nowadays, but I by no means discovered any interesting article like yours. It is lovely worth sufficient for me. In my view, if all site owners and bloggers made good content material as you did, the internet will probably be much more useful than ever before.
helpful ;)
The third Version is the best way.
What if the first option doesnot work? How do I check it? Is that a caching issue?
I like the tutorial..♥
I need more help from you…
Could you please help me to learn more
Fantastic post man!
Thanks for sharing this with us,keep on posting.
Really helpful for making things work in IE6 and IE7. Thanks a lot for this tutorial.
Excellent post. I will try to make this kind of specific CSS for Internet Explorer to make it fast :D
First method is good, because it will be good for debugging and adding new styles for ie, if we keep it in a separate file.