【发布时间】:2026-01-11 18:35:01
【问题描述】:
我有一张我正在尝试使用 HTML/CSS 创建的图像。我对 flexbox 进行了一些研究。我不想明确设置文本 div 的高度。
我有一个我目前所在位置的 jsfiddle -http://jsfiddle.net/wxc0jmjw/1/(js 小提琴中没有图像)基本上,我只需要在容器顶部的一些文本,在底部的一些文本,以及高度根据内容的高度变化。任何帮助表示赞赏!
.flexbox-container {
padding: 20px;
background: #eee;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-align: center;
-webkit-align-items: center;
-webkit-box-align: center;
align-items: flex-end;
}
.flexbox-vert-item {
width: 300px;
background: #fefefe;
margin-right: 20px;
padding: 10px;
}
.flexbox-vert-item2 {
width: 300px;
background: #fefefe;
margin-right: 20px;
padding: 10px;
}
.demo-wrapper {
min-height: 500px;
}
<div class="flexbox-container">
<div class="wrapper">
<div class="flexbox-vert-item2">SOme text at the top</div>
<div class="flexbox-vert-item">Blah blah 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 123 </div>
</div>
<div class="wrapper">
<div class="flexbox-vert-item2">SOme text at the top</div>
<div class="flexbox-vert-item">Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah </div>
</div>
</div>
【问题讨论】: