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!
background defined later should replace the previous ones. So if you have:
Site1.css which has:
Site2.css which has:
then Site2.css .img would replace .img within Site1.css if Site2.css is included after Site1.css on your page.
UPDATE: I’m not sure why the body tag is not being replaced correctly. Could you try to give it a class or id, and use that instead of body?
e.g.
And then in the css files you would do
#backgroundTest { background-image... }And just in case, could you check if homeBg.png exists and index.css. http://yourpage.com/homeBg.png and http://yourpage.com/index.css should both exist.