CSS | inline, inline-block, block 에 대해서


display: inline
- 태그 안의 글자 길이만큼의 영역만 화면에 표시한다.
width, height 속성에 영향을 받지 않는다
- inline을 default값으로 가지고 있는 tag:
<span>, <a>, <img>
- inherently inline:
<em>, <i>, <strong>, <small>
width, height 속성에 영향을 받지 않는다<span>, <a>, <img><em>, <i>, <strong>, <small>
.inline-element {
display: inline;
width: 1000px; /* ❌ won't have any effect */
height: 1000px; /* ❌ won't have any effect */
}
display: inline-block
- inline과 같이 양 옆으로 화면에 나열할 수 있다.
- inline과 다른점은 width, height 속성을 통해 사이즈 조절이 가능하다.
- inline-block을 default값으로 가지고 있는 tag:
<button>, <input>, <select>, <textarea>
<button>, <input>, <select>, <textarea>
.inline-block-element {
display: inline-block;
width: 1000px; /* ✅ yes, it will work */
height: 1000px; /* ✅ yes, it will work */
}
display: block

- inline과 달리, 새로운 줄로 시작하며 해당 줄의 가로를 다 차지한다.
- block을 default값으로 가지고 있는 tag:
<div>,<h1>,<p>,<li>,<section>
이미지 출처:
https://www.samanthaming.com/pictorials/css-inline-vs-inlineblock-vs-block/
Author And Source
이 문제에 관하여(CSS | inline, inline-block, block 에 대해서), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@celeste/CSS-inline-inline-block-block-에-대해서저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)