<img>
, <span>
, <input>
, <label>
, <button>
등<div>
, <p>
, <h1>
등inline(가로), block(세로) 배치 차이가 있다!
span {
background-color: yellow;
border: 1px solid black;
margin: 5px;
}
div {
background-color: yellowgreen;
width: 50px;
height: 50px;
border: 1px solid black;
margin: 5px;
}
<body>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<div>1234</div>
<div>2234</div>
<div>3234</div>
<div>4234</div>
<div>5234</div>
</body>
span {
display: block;
background-color: yellow;
border: 1px solid black;
margin: 10px;
}
div {
display: inline;
background-color: yellowgreen;
border: 1px solid black;
margin: 10px;
}
배치는 inline처럼 가로로! 속성은 block처럼 width, height등 적용가능!
div {
display: inline-block;
background-color: yellowgreen;
border: 1px solid black;
width: 50px;
height: 50px;
margin: 10px;
}