:has pseudo selector in CSS for Navbar
HTML
`
<div class="container">
          <div class="item">Home</div>
          <div class="item">Shop</div>
          <div class="item">About</div>
          <div class="item">Contact</div>
CSS
.container {
           display: flex;
           padding: 2rem 3rem;
           gap: 2rem;
           border-radius: 1 rem;
CSS
Select any .item that is not hovered, but is inside a .container which has an .item that is hovered
.item {
color: #ffffff;
transition: color 300ms;
}
.container: has(.item:hover)
   .item:not(:hover)  {
    color: #888888;
}
by Tinatin Kvinikadze
1 year ago
CSS
HTML
Pseudo selector
0
Pro tip: use ```triple backticks around text``` to write in code fences