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

Inflearn Community Q&A

ysk25305253's profile image
ysk25305253

asked

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

Pseudo-classes before after Practical Publishing using Pseudo-classes 01 (Basic Usage of before after)

궁금합니당..

Written on

·

144

1

선생님 ~ 하다가 사소한 질문이 있는데요..음..

css에서.gnb a:before  아래 text-align: center;  이랑,  line-height: 30px; 을 주셨잖아요 !

이 두개가 여전히 헷갈려서 그런데 .. 현재 display: inline-block;으로 바꾼상태인데 전 강의에서  inline-block 일때는 text-align: center;는 부모요소에 주라고 했던거같은데.. 그럼 .gnb a  에 줄게 아니라 .gnb 에 주는게 맞는거 아닌지.. 사소하지만 여쭤볼게요 ㅠㅠ 

jqueryHTML/CSS

Answer 1

1

codingworks님의 프로필 이미지
codingworks
Instructor

:before :after는 인라인 요소라서 크기값을 주기 위해서 inline-block 또는 block이 되어야 합니다.

그래서 .gnb a:before에 inline-block을 준거에요.

text-align: center는 인라인요소 블록요소 관계없이 모두 적용됩니다.

그리고 강의보시면 .gnb a에는 어떠한 속성도 주지 않았어요.

.gnb 자체는 div이기 때문에 블록요소에요.

ysk25305253's profile image
ysk25305253

asked

Ask a question