2 回答
TA贡献1796条经验 获得超4个赞
尝试使用align-content属性。我还做了一些其他细微的更改,并添加了颜色和边框以获得更好的可视化效果。
.picker {
height: 75px;
width: 300px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-content: flex-start;
border: 1px solid black;
}
.pickeritem {
height: 25px;
width: 50px;
flex-shrink: 0;
display: flex;
align-items: center;
margin: 0 10px;
background-color: #fbbdbd;
}
<div class='picker'>
<div class='pickeritem'>1</div>
<div class='pickeritem'>2</div>
<div class='pickeritem'>3</div>
<div class='pickeritem'>4</div>
<div class='pickeritem'>5</div>
<div class='pickeritem'>6</div>
<div class='pickeritem'>7</div>
<div class='pickeritem'>8</div>
<div class='pickeritem'>9</div>
<div>
TA贡献1807条经验 获得超9个赞
您可以使用
.picker {
height: 75px;
width: 100%;
display: flex;
flex-direction: row;
justify-content:flex-start;
}
.pickeritem {
height: 25px;
flex-shrink: 0;
display: flex;
align-items: center;
margin: 0 10px;
}
添加回答
举报