CSS Width / Height
- 입력한 요소의 넓이(Width)와 높이(Height)를 설정할 수 있다.
Width/Height의 기본표기
Width : 크기;
Height : 크기;
#. 넓이(Width).높이(Height).
넓이(Width)속성은 요소의 넓이를 설정할 수 있도록 한다.
인라인 요소는 높이/넓이를 설정할 수 없다.
#.Width 예제 1.
<style>
.divWidth{
background:pink;
Width: 200px;
height: 200px;
}
.spanWidth{
background:tomato;
width: 200px;
height: 200px;
}
</style>
<div class="divWidth">Hello Div!</div>
<span class="spanWidth">Hello Span!</span>
📍출력물
Hello Div!Hello Span!
⭐️위에서 언급한데로 div
는 블록요소
로 넓이/높이 모두 적용이 가능하나,
span
은 인라인요소
로서 넓이/높이 모두 설정이 불가능하다.