I have the body tag and the background color will change if there is a div.login as a child.
...
<body>
<div class="container"><div class="login"></div></div>
<body>
...
I have the body tag and the background color will change if there is a div.login as a child.
...
<body>
<div class="container"><div class="login"></div></div>
<body>
...
There are no parent selectors in CSS.
There are several ways to dynamically select the parent of an element, but they all involve a bit of JavaScript, such as jQuery's parent () method.
Using SASS, you can do something using the ampersand operator:
Try using:
div.container {
body & {
background-color: red;
}
}
I'm starting now, I do not know if it's the best way to do it. Test and see if it works. I hope I have helped !!