CSS Tags Specific to Browser [IE6, IE7]

I came across this posting on Ed Eliot's blog and had NO idea this existed but it made my life a lot easier.  Full credit goes to him on this - the below is cut and pasted directly from his blog so I know where to find it in the future.  The URL for this post on his blog is:
http://www.ejeliot.com/blog/63

.box {
background: #00f; /* all browsers including Mac IE */
*background: #f00; /* IE 7 and below */
_background: #f60; /* IE 6 and below */
padding: 7px;
color: #fff;
}
I think it speaks for itself.  In my case, I easily fixed my annoying IE6 problem by applying a negative bottom margin that only applies to IE6.  Perfect.  I have used conditional statements to load CSS files based on your browser, but this is really helpful for those elements where you need to apply a tag to an element here or there - no point in creating an entirely different CSS file for things like this.

Update [12.9.2008], I also came across a Safari specific hack...
.submit {margin: 20px;}
.hint {right: 168px#;} /* Safari will ignore tags with the pound sign and EVERYTHING THAT FOLLOWS */

Print | posted @ Thursday, August 28, 2008 11:46 AM

Comments on this entry:

Gravatar # re: CSS Tags Specific to Browser [IE6, IE7]
by Mr. Tweedy at 7/1/2009 2:30 AM

Awesome tip! Thanks! Now I can deal with IE misbehavior directly and decisively.
Gravatar # re: CSS Tags Specific to Browser [IE6, IE7]
by Aaron at 10/12/2009 11:02 AM

Exactly what I needed, Thanks!!!
Works well to seperate IE6 and IE7 issues...
Gravatar # re: CSS Tags Specific to Browser [IE6, IE7]
by webmaster at 10/20/2009 11:56 PM

Thank's a lot
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 
Twitter