How to override background image defined in CSS with another CSS?

aateeque picture aateeque · Jan 26, 2011 · Viewed 82.6k times · Source

I have a 'Core.css' which defines a page background image, along with the theme, for the site. But for a specific page I want to change just the background. Any suggestions on how this can be achieved in a separate CSS file?

The HTML for the page is:

<head>
    <link rel="stylesheet" type="text/css" href="core.css" />
    <link rel="stylesheet" type="text/css" href="index.css" />

And core.css defines:

body
{
        background-image: url('bg.png');
}

While index.css defines:

body
{
    background-image:('homeBg.png');
}

Thanks!

Answer

unknownrisk picture unknownrisk · Jan 22, 2013

If you want to replace the background image with nothing (i.e. make it inactive or "turn it off"), use the "none" keyword in your downstream style sheet:

 background-image: none;