-
[css] 다른 요소에 영향을 주는 hoverNote 2021. 3. 28. 20:14
stackoverflow.com/questions/4502633/how-to-affect-other-elements-when-one-element-is-hovered
How to affect other elements when one element is hovered
What I want to do is when a certain div is hovered, it'd affect the properties of another div. For example, in this JSFiddle demo, when you hover over #cube it changes the background-color but what I
stackoverflow.com
요소가 컨테이너 내부에 직접 있는 경우
#container:hover > #cube { background-color: yellow; }
요소가 컨테이너 옆에 있는 경우(컨테이너 태그 닫은 후)
#container:hover + #cube { background-color: yellow; }
요소가 컨테이너 내부 어딘가에 있는 경우
#container:hover #cube { background-color: yellow; }
요소와 컨테이너가 형제인 경우
#container:hover ~ #cube { background-color: yellow; }
'Note' 카테고리의 다른 글
크롬으로 모바일 키보드 테스트 (0) 2021.03.31 script 태그의 위치 (0) 2021.03.29 브라우저 크기 측정 (0) 2021.03.23 [css] ntn-child, ntn-last-child (0) 2021.03.22 Typescript (0) 2021.02.26