CSS: selecting an element only if it contains a specific element

boba

New Member
I am creating a print stylesheet and would like to hide all \[code\]figure\[/code\] tags only if that tag contains an \[code\]iframe\[/code\], which happen to be embedded YouTube videos. If the \[code\]figure\[/code\] tag contains anything else (i.e. an \[code\]img\[/code\]), I want the tag and its contents to still be shown on the printed page.I know that I could simply apply a \[code\]class\[/code\] of "video", for example, to my \[code\]figure\[/code\] tag where appropriate, but I want to see if there is a way to accomplish this via CSS without resorting to adding classes throughout my site. Also, even though I know they exist, I am not looking for a jQuery solution.Thank you!
 
Back
Top