【问题标题】:Bootstrap4: vertical align button at the bottomBootstrap 4:底部的垂直对齐按钮
【发布时间】:2023-03-12 16:55:01
【问题描述】:

我很难对齐每张卡片底部的按钮: https://jsfiddle.net/xzgsnk85/

<div class="col-sm-6 col-md-4 col-lg-3 mb-3">
    <div class="card h-100">
        <div class="white-bg rounded text-center p-4 mt-2">
            <div class="partner-logo mb-1">
                <img src="coding.svg" alt="partner logo" class="img-fluid">
                <p class="lead mb-3">J'ai un problème avec mon site web</p>
            </div>
            <a href="#" class="btn primary-solid-btn mt-auto">Sélectionner</a>
        </div>
    </div>
</div>

我使用了mt-auto,但没有效果。

请问我在这里缺少什么?

【问题讨论】:

    标签: bootstrap-4 flexbox


    【解决方案1】:

    您可以使用 flex 来对齐底部的按钮。将d-flex、flex-column、justify-content-between 和h-100 类添加到&lt;div&gt;

    <div class="white-bg rounded text-center p-4 mt-2 d-flex flex-column justify-content-between h-100">
    

    【讨论】:

    • 太棒了!非常感谢。
    • Np。很高兴能提供帮助。
    猜你喜欢
    • 2018-08-23
    • 1970-01-01
    • 2021-07-12
    • 1970-01-01
    • 2019-12-15
    • 1970-01-01
    • 2021-11-03
    • 2017-01-19
    • 1970-01-01
    相关资源
    最近更新 更多