Return to Snippet

Revision: 34536
at October 24, 2010 10:02 by alozuldo


Initial Code
div {
  background-color: #999; /* all browsers */
  *background-color: #ccc; /* add a * before the property - IE7 and below */
  _background-color: #000; /* add a _ before the property - IE6 and below */
}

Initial URL
http://sixrevisions.com/css/10-random-css-tricks-you-might-want-to-know-about/

Initial Description
The code below will change the background-color of divs depending on what browser the user is viewing the web page under. Since * cascades down to IE7 and below, we use _ after that declaration so that IE6 (and below) has a different background color from IE7.

Initial Title
Target IE6 and IE7 Browsers without Conditional Comments

Initial Tags
css, browser, ie6

Initial Language
CSS