I would like to set up my page so that when the user hovers over a link in a div, the color of the body background is changed, but only while hovering. This is the css
What you want to do is actually not possible with CSS as you are asking if there is a parent selector BUT we can use some workarounds.
Here is an idea where I use a pseudo element from the a that I make it to cover the whole body and it behaves as the background of the body:
a {
color: white;
text-decoration: none;
}
a:before {
content: "";
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
background: #000;
z-index: -1;
pointer-events:none;
}
a:hover::before {
background: red;
}
link