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

  • SEARCH
  • Home
  • 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 8297631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:29:03+00:00 2026-06-08T15:29:03+00:00

I have 1 div and i want to apply a gradient and a background

  • 0

I have 1 div and i want to apply a gradient and a background image to it (yes, on the same element). I know that it’s only possible if the browser you`re targeting is NOT IE. With that in mind, i thought of applying a solid color in stead of the gradient with an image on top of it for IE only.

Here is my code:

background: url(../images/newsletter.png), -moz-linear-gradient(top, rgb(10,10,01) , rgb(5,5,5));
background: url(../images/newsletter.png), -webkit-gradient(linear, left top, left bottom, from(#0a0a0a), to(#05050f));
background-repeat: no-repeat, repeat;
<!--[if IE]>
background: #000 url(../images/newsletter.png) center left no-repeat;
<![endif]-->

The problem is the condition is ignored, before or after the declaration for FF/Chrome. (i`ve tested the and also the [if false] etc.)
Any ideas?

  • 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-08T15:29:05+00:00Added an answer on June 8, 2026 at 3:29 pm

    You don’t put that kind of conditional in CSS; it goes in your HTML. So create a new stylesheet with the IE fix, and link to it in a conditional comment:

    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="ie.css" />
    <![endif]-->
    

    for example. However, that’s in general; you can rewrite what you have now as:

    background-color: black;
    background-image: url(../images/newsletter.png);
    background-image: url(../images/newsletter.png), -moz-linear-gradient(top, rgb(10,10,01) , rgb(5,5,5));
    background-image: url(../images/newsletter.png), -webkit-gradient(linear, left top, left bottom, from(#0a0a0a), to(#05050f));
    background-repeat: no-repeat;
    

    which degrades gracefully without ugly conditional comments, and doesn’t exclusively degrade gracefully on Internet Explorer.

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

Sidebar

Related Questions

I have a div that i want to apply two backgrounds to it. Basically
I have a few div elements that i want to dynamically apply an effect
I have a DIV that I want to touch the bottom of the screen
I have a div that I want to toggle between displaying or not when
I have a div that I want when user click on a button slideUp
I have a div set transparent with rgba and want on that div an
I want to do this: I have a div with item: title, image, some
I have a DIV to which I want to apply a style currently prescribed
I have one div element at the top of my page that is set
i have this elements <div class="a b"></div> <div class="b"></div> <div class="a"></div> I want apply

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.