html - CSS class:hover select all other elements -
i can't find how online, how go selecting elements within element , apply styles them. example:
html:
<div class="cont"> <div class="txt">hello world!</div> <img src="img1.jpg"> <img src="img2.jpg"> </div> css:
.txt:hover + img { display:none; } i want class style hide images next it. hides 1 image @ moment though...
if want hide all succeeding image elements, use general sibling combinator, ~.
.txt:hover ~ img { display:none; } you using adjacent sibling combinator, +, hide adjacent element.
Comments
Post a Comment