I have a question about css flex. My code:
.box {
width: 300px;
height: 300px;
background: aqua;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: left;
align-items: baseline;
align-content: stretch;
}
.item {
width: 50px;
height: 50px;
background: rgb(243, 62, 92);
font-size: 13px;
color: #fff;
border-radius: 50%;
display: flex;
justify-content: center;
/* align-self: center; */
align-items: center;
}
.box .one {
/* padding-top: 20px; */
background: red;
/* order: 1; */
/* flex-shrink: 1; */
align-self: stretch;
}
.box .two {
background: coral;
order: 2;
flex-shrink: 1;
}
.box .three {
background: forestgreen;
order: 31;
flex-shrink: 1;
}
.box .four {
background: tomato;
order: 4;
}
<div class="box">
<div class="item one">项目1</div>
<div class="item two">项目2</div>
<div class="item three">项目3</div>
<div class="item four">项目4</div>
</div>
I have a flex container with several flex items, and I want to stretch one of the items in the cross-axis direction using the align-self: stretch;
property. However, the item does not seem to be stretched, and I'm not sure why this is happening. Can you help me understand why align-self: stretch;
is not working in this case?
Thanks.