首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用bootstrap将两个按钮居中对齐

使用bootstrap将两个按钮居中对齐
EN

Stack Overflow用户
提问于 2021-09-01 17:35:21
回答 1查看 12关注 0票数 0

我有下面的div,并希望两个按钮对齐到中心。现在按钮是靠左对齐的。我添加了"justify-content-center“,但仍然没有居中。我正在使用bootstrap 5

代码语言:javascript
复制
    <div class="col-8 offset-2 col-lg-9 col-xl-6 offset-xl-3">
        <div class="row">
            <h1 class="mt-5">What is this all about. What is this all about. What is this all abour?</h1>
        </div>
        <div class="row mt-5 justify-content-center">
            <div class="col">
                <button type="button" class="btn btn-primary m-2">Yes Please</button>
                <button type="button" class="btn btn-primary">No Please</button>
            </div>
        </div>
    </div>

我做错什么了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-01 17:41:12

将"justify-content-center“替换为"text-center”。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69018334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档