Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8609091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:47:27+00:00 2026-06-12T03:47:27+00:00

When using an IE Conditionals (such as the code below) with !important, regardless of

  • 0

When using an IE Conditionals (such as the code below) with !important, regardless of the browser the background is defaulting to the background-color with !important even while inside an IE conditional.

How could one rewrite this so that the browser accepts the background color in less than IE9 and the image (with height/width: 100%, no-repeat) in IE9 and other browsers?

Note: I plan to use this in a WordPress site where the theme is automatically setting the color or image by default, so I have to use the !important to override the default theme styling.

body {
<!--[if lt IE 9]>
background-color:#c1beb2 !important;
background:#c1beb2 !important;
<![endif]-->
<!--[if gte IE 9]>
background-image: url("http://example.com/wp-content/example.png") !important;
background-position:left bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
<![endif]-->
<![if !IE]>
background-image: url("http://example.com/wp-content/example.png") !important;
background-position:left bottom;
background-size: 100% 100%;
background-repeat: no-repeat;
<![endif]>
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:47:28+00:00Added an answer on June 12, 2026 at 3:47 am

    Conditional comments are meant to be used in HTML, not CSS.

    That is, link to an IE specific style sheet like this in your HTML:

    <!--[if lte IE 9]> 
    <link rel="stylesheet" href="/ie.css" type="text/css" media="no title" charset="utf-8" />
    <![endif]-->
    

    That’s the proper way to do it. If you don’t want to create a whole other IE-specific stylesheet, you can rely on CSS IE Hacks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was just reading a recent question on using conditionals in Linq and it
I'd like to know if having to conditionals when using a JOIN keyword is
I'm trying to call WordPress's 'the_time' using a conditional statement that checks the category.
I'm trying to create an conditional Rewrite Rule using an .htaccess file and Apache.
I am using ExpressionEngine 2.2.1 and am trying to create a conditional that will
I am using Oracle 11g client, with ODP.NET. I am trying to add conditional
I have folowing code in which i am using some conditions on page to
My questions are divided into three parts Question 1 Consider the below code, #include
I am using this kind of code in JavaScript. if(typeof a[x] != undefined &&
Sometimes, when using macros to generate code, it is necessary to create identifiers that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.