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

Inflearn Community Q&A

zpunsss3275's profile image
zpunsss3275

asked

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

Practical Publishing 05: Extended Selectors + `:checked` Pseudo-class (Tab Content - Opacity Application)

top, translateY() 차이에 대해 질문입니다.

Written on

·

369

1

항상 고생하십니다.

예제를 할 때 제가 먼저 구현해보고 선생님의 코드와 비교하면서 진행하고 있습니다.

저 같은 경우는 headling text부분 즉, Sale부분의 좌표를 top으로만 설정해 checked경우에도 top으로 좌표를 조정했습니다. 

근데 선생님의 코드의 경우 top으로 위치를 잡아주시고 transform: translateY()속성으로 위치를 y축 기준으로 올리셨는대, 오로지 top의 수치로만 조정하는 것과, translateY()를 사용하는 것의 큰 차이가 있는지 여쭤보고 싶습니다.

HTML/CSSjquery

Answer 1

1

codingworks님의 프로필 이미지
codingworks
Instructor

position: absolute로 좌표를 잡은건 최종적으로 위치할 위치를 잡은거에요.

그리고 transform: translateY()는 최종적인 위치에서 위로 이동시켜놓으려고 한거에요.

top 좌표로 변화를 줘도 되지만 top 좌표가 변화되는 형태보다는 transform: translateY()로 위치를 변경해주는 것이 효율적이라서 그렇습니다.

zpunsss3275's profile image
zpunsss3275

asked

Ask a question