6
Good Morning! Is it possible to change the parent element by giving Hover to the child? For example, I have the following:
nav {border:2px solid red}
nav ul li {color:#fff}
nav ul li a:hover {background-color:#ccc}
nav ul li a:hover nav {border:2px solid black}
<nav>
<ul>
<li> <a href="#">Teste</a> </li>
<li> <a href="#">Teste</a> </li>
</ul>
</nav>
When passing the mouse on <a>
, I want the <nav>
change the color of the border.
I’ve read something about not being able to take the parent element and that it will be available in css 4. If it’s really true, how can I do it by js?
Could illustrate better the issue of the pseudo selector
.has()
? Taking into account that CSS 4 has already been implemented, how it would be applied in this context?– Marciano.Andrade
updated response.
– Tobias Mesquita