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

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -