gpt4 book ai didi

css - 在一行内使列高度均匀

转载 作者:太空宇宙 更新时间:2023-11-03 21:30:26 25 4
gpt4 key购买 nike

如何在 bootstrap 中控制列,以保持它们的高度相同,内部文本长度不同,并使文本保持在顶部?

我需要的例子: enter image description here

这是到目前为止的标记:

<div class="row-same-height row-full-height">
<div class="col-xs-6 col-xs-height col-full-height warning"><div class="item"><div class="content "><h2>No cost, as long as you want the contents of the columns to be centered between the top and bottom</h2></div></div></div>
<div class="col-xs-3 col-xs-height col-full-height"><div class="item"><div class="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pretium facilisis volutpat. Pellentesque finibus diam nec commodo eleifend. Pellentesque varius felis ac metus vestibulum, id vestibulum mi congue. Vestibulum quis sem ultrices, pharetra est id, pretium neque. Maecenas pulvinar urna vel orci tincidunt, eu consequat magna efficitur. Maecenas commodo mi erat, id placerat ipsum dignissim at. Nunc sed laoreet lorem. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Integer a sapien at dolor pulvinar pretium quis eget ligula.</div></div></div>
<div class="col-xs-2 col-xs-height col-full-height"><div class="item"><div class="content">Yes, really </div></div></div>
<div class="col-xs-1 col-xs-height col-full-height"><div class="item"><div class="content"></div></div></div>

</div>

最佳答案

你可以使用 CSS3 的 flexbox 模型来完成这个:

.row-same-height {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}

http://jsfiddle.net/5vrutebn/

关于css - 在一行内使列高度均匀,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29784697/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com