css - How it's possible add style on hover if element is an immediate previous of that element? -
a:hover + ul{ display:none; }
<li> <a>hover me</a> <ul> hide me</ul> </li> <li> <p>change color</p> <ul>hover me</ul> </li>
i know it's possible add style particular element using '+' if it's immediate next element(as shown above).is possible apply hover if element immediate previous ?
that not possible css selectors use kind of hack change order of elements flexbox
, use +
selector.
div { display: flex; flex-direction: column; } strong:hover + p { color: blue; } p { order: -1; }
<div> <strong>hover me</strong> <p>change color</p> </div>
Comments
Post a Comment