웹(web)/프론트엔드-css

CSS Height and Width

바코94 2020. 5. 5. 22:20

css의 height, width에 설정할 수 있는 종류는 5가지이다.

 

auto: 따로 지정하지 않으면 auto가 default이고 브라우저가 계산한 값으로 들어감.

length: px, cm 등 수치를 입력하는 방법.

%: 해당 element를 감싸는 block의 width, height를 기준으로 계산됨.

initial: default value로 설정(?). 브라우저가 지정한 값으로 설정.

inherit: 부모의 값을 사용.

 

 

?auto와 initial이 같은 의미로 보이나 다른 점을 발견하면 수정 필요함.

 

 

height, width 설명

https://www.w3schools.com/css/css_dimension.asp

 

initial 설명 

https://developer.mozilla.org/ko/docs/Web/CSS/initial