CSS - How to affect other elements when one element is hovered

HELLO WORLD🙌·2020년 4월 3일
0

Memo

목록 보기
4/7

#container
#cube

If the cube is directly inside the container:
#container:hover > #cube { background-color: yellow; }

If cube is next to (after containers closing tag) the container:
#container:hover + #cube { background-color: yellow; }

If the cube is somewhere inside the container:
#container:hover #cube { background-color: yellow; }

If the cube is a sibling of the container:
#container:hover ~ #cube { background-color: yellow; }

0개의 댓글