I am making a website with pure css and html , I want to behave in certain way with only using css.
i have a list and every time,i hover on any of them , i want others to take different color. what i have written , doesnt behave same way!
when i hover on any of them , only the items below it ,changes color:
<div class="sketch">
<div class="sketch-div">
<a href="#">Sketch</a>
</div>
<div class="hide">
<img width="50%" src="images/sketchcloud.jpg"
alt="Sketch Cloud">
</div>
</div>
<div class="WeTransfer">
<div class="WeTransfer-div">
<a href="#">WeTransfer</a>
</div>
<div class="hide">
<video width="50%" webkit-playsinline="webkit-playsinline">
<source src="images/wetransfer-preview.3b6e83b8.mp4" type="video/mp4">
</video>
</div>
</div>
<div class="Coffee">
<div>
<a href="#">Coffee by Benjamin</a>
</div>
<div class="hide">
<img width="50%" src="images/coffeebybenjamin.jpg"
alt="Coffee by Benjamin">
</div>
</div>
<div class="Beam">
<div>
<a href="#">Beam</a>
</div>
<div class="hide">
<video width="50%" webkit-playsinline="webkit-playsinline">
<source src="images/beam-preview.940b40c4.mp4" type="video/mp4">
</video>
</div>
</div>
<div class="More">
<div>
<a class="arrow" href="#">More</a>
</div>
<div class="hide">
</div>
</div>
above is inside nav
element.
this is css code for it :
.sketch:hover ~ .WeTransfer a{
color: #ccc;
}
.sketch:hover ~ .Coffee a{
color: #ccc;
}
.sketch:hover ~ .Beam a{
color: #ccc;
}
.sketch:hover ~ .More a{
color: #ccc;
}
/* Wetransfer */
.WeTransfer:hover ~ .sketch a{
color: #ccc ;
}
.WeTransfer:hover ~ .Coffee a{
color: #ccc;
}
.WeTransfer:hover ~ .Beam a{
color: #ccc;
}
.WeTransfer:hover ~ .More a{
color: #ccc;
}
/* Coffee */
.Coffee:hover ~ .WeTransfer a{
color: #ccc;
}
.Coffee:hover ~ .sketch a{
color: #ccc;
}
.Coffee:hover ~ .Beam a{
color: #ccc;
}
.Coffee:hover ~ .More a{
color: #ccc;
}
here im hovering on coffee by benjamin and elements below it get the different color , but the elements top of it wont change colors.
how can i do this just with css and html ?