html - pure css conditionally change background-color of body -


this question has answer here:

is possible in pure css change background-color of body element depending of id (or class) of first div inside body ?

for instance :

<body>    // background-color black   <div id="abc"> ... </div> </body>   <body>    // background-color red   <div id="cde"> ... </div> </body> 

no there's no way of doing purely in css. you'll need javascript/jquery that, change body background it.

if ($('#abc')[0]) {    $('body').css('background','black') } if ($('#cde')[0]) {    $('body').css('background','red') } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -