如何使AllowHttpStatus
都具有相同的高度。 .child
无效,height: 100%
也无效。使用flexbox的推荐方法是什么?
flex-grow: 1
.parent {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 800px;
}
.child {
width: 150px;
background-color: green;
border: solid 1px black;
}
答案 0 :(得分:1)
从父级中删除align-items:center
并为子级添加flex属性以使其内容对齐。
.parent {
display: flex;
flex-direction: row;
justify-content: center;
width: 800px;
}
.child {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
width: 150px;
background-color: green;
border: solid 1px black;
}
<div class="parent">
<div class="child">
Short Text
</div>
<div class="child">
Long Text: Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla
</div>
<div class="child">
Short Text
</div>
</div>
答案 1 :(得分:1)
.parent {
display: flex;
flex-direction: row;
width: 800px;
justify-content: center;
align-items: stretch;
}
.child {
width: 150px;
background-color: green;
border: solid 1px black;
}
<div class="parent">
<div class="child">
Short Text
</div>
<div class="child">
Long Text: Bla bla bla Bla bla bla Bla bla bla Bla bla bla Bla bla bla
</div>
<div class="child">
Short Text
</div>
</div>