Using Drupal, the theme has a background color assigned to the <HTML> element. I’m creating a separate print CSS for ONE particular page, and wish to remove the background color ONLY for this page when the user prints the page. The <HTML> element has no class, or id, but the <BODY> element does.
<HTML style="background-color:#666">
<BODY class=specialPage>
</body>
</html>
Is there a way to specify that I want the parent element of <BODY>? Or some way of targeting <HTML> based on the class of <BODY>?
EDIT:
|------------------------|
| <HTML> |
| |----------| |
| | | |
| | <BODY> | |
| | | |
| |----------| |
| |
|------------------------|
In jQuery you can do the following:
This will work whether another element contains
bodyor not.Here’s a working jsFiddle.
Also, you should use lowercase letters for your html elements,
htmlinstead ofHTML.