gpt4 book ai didi

css - 具有 bootstrap 的响应式盒子网格 - 4 种不同的盒子高度

转载 作者:行者123 更新时间:2023-11-28 00:48:34 25 4
gpt4 key购买 nike

我尝试使用框类和 Bootstrap 制作一个包含 6 个文本框的响应式网格。

我的问题是,文本框内的文本数量不同,它们具有不同的宽度/高度,但我希望它们与文本最多的框具有相同的最大高度/最大宽度。

是否有机会在不对所有框的宽度/高度进行硬编码的情况下完成此操作?

这是一个代码片段:

/***** Box *****/

.flex-box {
position: relative;
text-align: center;
margin-top: 10px;
margin-right: auto;
margin-bottom: ;
margin-left: auto;
padding: 40px;
transition: all 0.3s ease;
background-color: rgb(170, 230, 255);
}

.flex-box:hover {
margin-top: 5px;
margin-bottom: 5px;
-webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.25);
}
<!-- Textbox-Sections -->
<section id="about_me" class="section-padding title">
<div class="container-fluid">
<div class="container pt-4">
<h1 class="title">About me</h1>
<div class="row">
<div class="col col-12 col-sm-6 col-lg-4">
<div class="flex-box">
<h1 class="boxtitle">My way</h1>
<p class="lead">
<div>Lorem ipsum dolor sit amet consectetur adipisicing elit. Deleniti fuga iusto aspernatur magni rem quas deserunt repellendus hic fugit amet tempora labore perferendis, voluptate possimus itaque cum molestias dolores. Omnis?</div>
</p>
</div>
</div>
<div class="col col-12 col-sm-6 col-lg-4">
<div class="flex-box">
<h1 class="boxtitle">My way</h1>
<p class="lead">
<div>Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse voluptatum soluta cum provident explicabo fugiat dolores odit blanditiis dolorem magni. Quaerat temporibus doloremque beatae voluptatum dignissimos? Eligendi voluptatum similique
incidunt!
</div>
</p>
</div>
</div>
<div class="col col-12 col-sm-6 col-lg-4">
<div class="flex-box">
<h1 class="boxtitle">My way</h1>
<p class="lead">
<div>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptate ipsam neque recusandae similique. Inventore repellendus aliquid delectus explicabo dolore sapiente voluptas nihil dolorem tempore voluptates, nemo ipsum cumque animi quidem.</div>
</p>
</div>
</div>

<div class="col col-12 col-sm-6 col-lg-4">
<div class="flex-box">
<h1 class="boxtitle">My way</h1>
<p class="lead">
<div>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quod illo incidunt nihil praesentium minus itaque hic, soluta dicta cupiditate quos dolorum esse, harum placeat, qui veritatis animi sunt? Ab, nobis.</div>
</p>
</div>
</div>
<div class="col col-12 col-sm-6 col-lg-4">
<div class="flex-box">
<h1 class="boxtitle">My way</h1>
<p class="lead">
<div>Lorem ipsum dolor sit amet consectetur adipisicing elit. Magni, fuga vel. Maxime hic tempore quo animi ex vero doloribus dolores quos, sapiente delectus dolor et laborum amet quam aspernatur earum.</div>
</p>
</div>
</div>
<div class="col col-12 col-sm-6 col-lg-4">
<div class="flex-box">
<h1 class="boxtitle">My way</h1>
<p class="lead">
<div>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dicta, repellendus distinctio ratione autem consequatur rerum libero nesciunt ullam eaque molestias odit architecto nisi incidunt quasi omnis ut. Natus, exercitationem alias.</div>
</p>
</div>
</div>
</div>
</div>
</div>
</section>

Here's a link to the CodePen site

谢谢

最佳答案

只需将 .flex-box 设置为 height:100% 使其填充 col-*...

https://codepen.io/anon/pen/GQORQV?editors=1100

.flex-box {
position: relative;
text-align: center;
margin-top: 10px;
margin-right: auto;
margin-bottom:;
margin-left: auto;
padding: 40px;
height: 100%;
transition: all 0.3s ease;
background-color: rgb(170, 230, 255);
}

关于css - 具有 bootstrap 的响应式盒子网格 - 4 种不同的盒子高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48812205/

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