I am writing a CSS stylesheet to add a background image to a div identified by its class name as follows:
.scrollingResultsContainer
{
background-image: url(https://mdl0133/widget/Images/gradient.gif);
background-repeat: repeat-x;
background-attachment: fixed;
color:#FFFFFF;
}
This works fine except I have one particular situation where I do not want the image to appear in the scrollingResultsContainer. How can I specify that the image should be applied except when the scrollingResultsContainer happens to contain a div with a particular id?
Unfortunately, I am unable to amend the markup to prevent this situation from occurring.
I was wondering if it can be done using CSS3 selectors.
You can’t do this with CSS. A parent selector has been proposed many times but is always rejected because apparently it’s just too hard to code or something:
http://www.css3.info/shaun-inman-proposes-css-qualified-selectors/
You’ll have to use javascript I’m afraid.