引导环境中子项的高度相同

时间:2019-06-19 21:19:51

标签: css bootstrap-4 flexbox height

Bootstrap 4很棒,因为它带有flexbox,它解决了很多问题,尤其是垂直对齐,但是如何只处理框架的一部分,以及如果我不想直接针对元素,该怎么办呢?元素内有一个孩子?

这是我的问题。

我正在使用我的bootstrap4版本,该版本很小,我想构建此结构:

<div class="row">
    <div class="col-md-4">
        <div>
            <h2>Diplôme en Big Data</h2>
            <img src="https://cceconcordia.ca/wp-content/uploads/2019/06/2.jpg" alt="">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book./p>
            <a href="#">En savoir plus</a>
        </div>
    </div>
    <div class="col-md-4">
        <div>
            <h2>Certificat en Big Data pour les entreprises</h2>
            <img src="https://cceconcordia.ca/wp-content/uploads/2019/06/3.jpg" alt="">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Bla blabla bla bla bla bla</p>
            <a href="#">En savoir plus</a>
        </div>
    </div>
    <div class="col-md-4">
        <div>
            <h2>Certificat de gestion de système en Big Data</h2>
            <img src="https://cceconcordia.ca/wp-content/uploads/2019/06/4.jpg" alt="">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
            <a href="#">En savoir plus</a>
        </div>
    </div>
</div>

这只是lorem ipsum的一个示例,但是我的目标是使<p>元素在不同页面中的高度相同,无论如何。如果我将父元素作为目标,则结果可以通过flexbox来实现:

.row {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}
.col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
}

就足够了,但是我想用引导程序4中的类定位<p>元素,以使所有元素的高度相同。有可能吗?

0 个答案:

没有答案