Hi everyone ! I've been searching this for a while, and still have never found an answer, so here I am. I would like to create a css rule that will only apply to a parent div that has a certain child. More precisely, I would like to style that parent div when one of its sub div contains a specific link. I already found the selector to modify that link (ie : a[href="http..."]), but is it possible to change its parent accordingly ?
for cross-browser support you'll need a JS solution (either to find the affected link and then modify the parent div accordingly, or something like the IE7 lib to add better CSS support to IE).
Actually, let me amend that, I thought there was a way to do it in CSS but I don't see any selectors that let you choose the parent of something to apply a style to. A JS solution is probably the way to go for this.
That is CSS3 and is probably what you're looking for since it applies the styling to the whole block. It is still just a draft so as the above poster said, a JS solution is the best for this, me thinks.