html - How to use Adjacent sibling selectors in css -
here html code:
<div id="main"> <h1> <div class="details-of-family-members">details of family members</div> </h1> <div class="wrap data"> <h1> hello</h1> </div> </div>
here css hide .wrap.data
div based on div of class .details-of-family-members
inside h1.
in css3 there isn't option select parent based on child.
we got sittuation: h1
sibling of .wrap.data
, not details-of-family-members
.
therefore, should add class details-of-family-members
h1
tag. , can:
.details-of-family-members + .wrap.data { display:none; }
.details-of-family-members + .wrap.data{ display:none; }
<div id="main"> <h1 class="details-of-family-members"> <div>details of family members</div> </h1> <div class="wrap data"> <h1> hello</h1> </div> </div>
Comments
Post a Comment