Hover on parent to change child

Giganews Newsgroups
Subject: Hover on parent to change child
Posted by:  Andrew Poulos (ap_pr…@hotmail.com)
Date: Sun, 23 Aug 2020

Is it possible to have :hover on a parent DIV which only changes the
background colour of one of its child DIVs?

<div class="parent">
  <div class="child-1"></div>
  <div class="child-2"></div>
  <div class="child-3"></div>
  <div class="child-4"></div>
</div>

..child-1 {
  background-color: #666666;
}

..parent:hover {
  /* css, but only for child-1 */
  background-color: #FFFFFF;
}

Andrew Poulos

Replies