Sometimes, we want to use :hover to modify the CSS of another class.
In this article, we’ll look at how to use :hover to modify the CSS of another class.
How to use :hover to modify the CSS of another class?
To use :hover to modify the CSS of another class, we can use it with another selector.
For instance, we write
.item:hover .wrapper {
color: #fff;
background-color: #000;
}
to select the elements with the class wrapper
in the elements with class item
that we hovered on.
We set its color and background-color for those elements.
Conclusion
To use :hover to modify the CSS of another class, we can use it with another selector.