1// If the cube is directly inside the container:
2#container:hover > #cube { background-color: yellow; }
3
4// If cube is next to (after containers closing tag) the container:
5#container:hover + #cube { background-color: yellow; }
6
7// If the cube is somewhere inside the container:
8#container:hover #cube { background-color: yellow; }
9
10// If the cube is a sibling of the container:
11#container:hover ~ #cube { background-color: yellow; }
1#a:hover ~ #b {
2 background: #ccc
3}
4
5<div id="a">Div A</div>
6<div>random other elements</div>
7<div>random other elements</div>
8<div>random other elements</div>
9<div id="b">Div B</div>
10
1#a:hover + #b {
2 background: #ccc
3}
4
5<div id="a">Div A</div>
6<div id="b">Div B</div>
7