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; } 

example here

you using adjacent sibling combinator, +, hide adjacent element.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -