<!-- display: flex -->
<div class="flexBox">
<div class="boxItem">item 1</div>
</div>
<!-- display: grid -->
<div class="gridBox">
<div class="boxItem">item 2</div>
</div>
.flexBox{
display:flex;
align-items:center; /* 방향이 row 기준: 세로 중앙 정렬*/
height:200px;
background:green;
}
.gridBox{
display:grid;
align-items:center; /* 방향이 row 기준: 세로 중앙 정렬*/
margin-top:30px;
height:200px;
background:orange;
}
.boxItem{
display:inline-block;
background:blue;
color:#fff;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.