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

Inflearn Community Q&A

nojjung5719's profile image
nojjung5719

asked

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

Practical Publishing using CSS Keyframe Animation 03 (Double Border Radius Animation)

.square div의 position

Written on

·

159

1

안녕하세요 코딩웍스님!! 질문이 있는데

.square div에 position : relative를 주고 

span들 보다 z-index 값을 높게 주는 방법은 별로일까요~? 

아니면 이미 div의 부모인 square에 positon relative가 있기 때문에 방지하는게 좋을까요~? 

jqueryHTML/CSS

Answer 1

1

codingworks님의 프로필 이미지
codingworks
Instructor

.square div에 position : relative를 주시는 것 보다 absolute 줘서 부모요소 .square 내에서 한 곳에 몰아주시구요.

z-index로 순서를 변경하실 필요는 없습니다.
.square span에  absolute가 있고, .square div에 absolute가 있잖아요.
둘 다 absolute가 있지만 z-index가 없는 기준이니까 html에서 늦게 나온 .square div가 위로 올라가게 됩니다.

부모요소인 .square에 relative 나머지 자식요소는 absolute 주세요.

nojjung5719's profile image
nojjung5719

asked

Ask a question