Code tagged with images

Making a Condition in CSS

Posted by Chad Humphries over 2 years ago
Make a condition with CSS. For instance if you have to apply different background-images to one particular DIV, in this case the mainContent as seen below in the CSS. You give an ID to the Body tag according to what page it is that will decide what image will go in the background of the mainContent DIV. (note: you can do this with as many properties as you want not just one). This works in both FireFox and Internet Explorer.

CSS:
body#aboutPage div#mainContent{
   background-image:url(images/image1.jpg);
}
body#contactPage div#mainContent{
   background-image:url(images/image2.jpg);
}
Language CSS / Tagged with images