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

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; }