CSS Flex布局-水平居中
html共 23 行
<style>
.flex {
display: flex;
justify-content: center;
background-color: #e8e8e8;
min-height: 150px;
}
.flex-item {
width: 100px;
height: 100px;
background-color: #2196F3;
border: 1px solid #000;
color: white;
font-size: 24px;
font-weight: bold;
text-align: center;
}
</style>
<div class="flex">
<div class="flex-item">1</div>
<div class="flex-item">2</div>
<div class="flex-item">3</div>
</div>