css when hover on element other component highlight too

Solutions on MaxInterview for css when hover on element other component highlight too by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "css when hover on element other component highlight too"
Amy
09 Mar 2018
1<div id="container">
2  <div id="cube">
3  </div>
4</div>
5
6//If the cube is directly inside the container:
7#container:hover > #cube { background-color: yellow; }
8
9//If cube is next to (after containers closing tag) the container:
10#container:hover + #cube { background-color: yellow; }
11
12//If the cube is somewhere inside the container:
13#container:hover #cube { background-color: yellow; }
14
15//If the cube is a sibling of the container:
16#container:hover ~ #cube { background-color: yellow; }