인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

themilky's profile image
themilky

asked

HTML+CSS+JS Portfolio Practical Publishing (Season 2)

Input attribute selector, adjacent selector, and sibling selector for creating tab menus

x표시

Written on

·

124

1

안녕하세요! 선생님!

버튼을 클릭했을때, 닫기 버튼이 slidebar 바깥에 나오게 하기 위해, 

label에 position absolute 를 주시고, input[id=trigger]:checked + label {left:250px;} 로 주셨는데요! 

저는 label에 따로 absolute를 주지않고, input[id=trigger]:checked + label {left:250px;} 값만 넣어도 잘 움직이더라구요~ 

label에 따로 absolute를 주신 이유가 궁금합니다! 

   

jqueryHTML/CSSjavascript

Answer 1

1

codingworks님의 프로필 이미지
codingworks
Instructor

label에 따로 absolute를 준 이유는 label의 위치를 왼쪽, 오른쪽 또는 오른쪽 중앙 등 원하는 위치로 옮기기 위해서 준 것 입니다. label에 따로 absolute를 주지 않고 움직였다면 label에 relative가 있어서 그렇습니다. 포지션 속성이 없으면 left, right, top, bottom은 작동하지 않습니다.

왼쪽을 기준으로 label을 배치하면 relative로 되지만 오른쪽으로 위치시키려면 absolute를 주셔야 합니다.

themilky's profile image
themilky

asked

Ask a question