gpt4 book ai didi

css - 如何使用 bootstrap 4 将标题和按钮对齐在同一行

转载 作者:行者123 更新时间:2023-11-28 10:26:53 27 4
gpt4 key购买 nike

我想将我的 h3 标题和按钮放在同一行上

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js" integrity="sha384-u/bQvRA/1bobcXlcEYpsEdFVK/vJs3+T+nXLsBYJthmdBuavHvAW6UsmqO2Gd/F9" crossorigin="anonymous"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container">
<div class="get-quote">
<div class="row">
<div class="col-md-12">
<h3 id="quote">IN HOUSE EMBROIDERY AND HEAT TRASNFER</h3> <button type="button" class="pull-right" class="btn btn-primary">Get Quote</button>
</div>
</div>
</div>
</div>

最佳答案

col-md-12 div 上添加 d-flex 类。

同时在按钮上添加 ml-auto 以右对齐按钮

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js" integrity="sha384-u/bQvRA/1bobcXlcEYpsEdFVK/vJs3+T+nXLsBYJthmdBuavHvAW6UsmqO2Gd/F9" crossorigin="anonymous"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<div class="container">
<div class="get-quote">
<div class="row">
<div class="col-md-12 d-flex">
<h3 id="quote">IN HOUSE EMBROIDERY AND HEAT TRASNFER</h3>
<button type="button" class="btn btn-primary ml-auto">Get Quote</button>
</div>
</div>
</div>
</div>

关于css - 如何使用 bootstrap 4 将标题和按钮对齐在同一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50740468/

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