如何使用flexbox在容器中水平和垂直居中div。在下面的例子中,我希望每个数字都在彼此的下方(以行为单位),它们水平居中。
.flex-container {
padding: 0;
margin: 0;
list-style: none;
display: flex;
align-items: center;
justify-content: center;
}
row {
width: 100%;
}
.flex-item {
background: tomato;
padding: 5px;
width: 200px;
height: 150px;
margin: 10px;
line-height: 150px;
color: white;
font-weight: bold;
font-size: 3em;
text-align: center;
}1
2
3
4
https://stackoverflow.com/questions/19026884
复制相似问题