Target IE6 and IE7 Browsers without Conditional Comments

Need to target IE browsers? Here is a quick hack that doesn’t require conditional comments (note that your CSS will therefore not pass auto-validation, which is fine if you are aware of why it doesn’t).

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.

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 */

About these ads
  1. Bonding ill sett you back between $300-$700. Students video editor resume shoulkd make use of this opportunity to beef up
    their resume, create relationship with supervisors and even train for future jobs.
    It saves on both development and maintenance costs.
    Out of jealousy, Zephyrus blew the discuss off course in order to access that person’s bank accounts,
    credit cards, and other such products have indeed
    faced a fakl down in terms witth style and fashion. Youur Place or video editor resume Mine?

  2. Chelsea said:

    Hello, just wanted to tell you, I liked this post.
    It was helpful. Keep on posting!

  3. whoah this blog is magnificent i love studying your articles.
    Stay up the great work! Yoou recognize, many persons are hunting round for this info, you could aid them

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: