bootstrap-4 - 尝试将引导按钮居中(避免“全宽”)
问题描述
此代码(使用引导程序 4)使按钮变为全角。
如何使按钮恰好适合它所在的文本?我认为它需要将它放在一个列中?
<section class="call-to-action text-white text-center">
<div class="overlay"></div>
<div class="container">
<div class="row">
<div class="col-xl-12" style="text-align:center">
<h1>Bunch of text Bunch of text Bunch of text Bunch of text Bunch of text Bunch of text Bunch of text</h1>
<a href="#scrolltotop" class="btn btn-block btn-lg btn-danger" style="margin-top:40px";>Find Out Now!</a>
</div>
</div>
</div>
</section>
感谢您对此的所有帮助-我对 Bootsrap 4 非常陌生。
解决方案
只需删除btn-block
并col-xs-**
在 V4 中删除。它被替换为col-**
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<section class="call-to-action text-white text-center">
<div class="overlay"></div>
<div class="container">
<div class="row">
<div class="col-12" style="text-align:center">
<h1 style="color:black">Bunch of text Bunch of text Bunch of text Bunch of text Bunch of text Bunch of text Bunch of text</h1>
<a href="#scrolltotop" class="btn btn-md btn-danger" style="margin-top:40px";>Find Out Now!</a>
</div>
</div>
</div>
</section>
推荐阅读
- python - 上下文不呈现我的 html 页面 - django
- php - “时间前”功能只有几个月和几年的 PHP
- c++ - 如何在 C++ 中获取更新的变量?
- python - 线程、多处理或异步,什么适合我的项目?
- sql - 如何获得 FDQuery 结果?
- php - 如何删除 @foreach 中的空白空格( $produtos as $produto )
- java - 错误更新android studio 3.6“在安装区域发现一些冲突?
- c# - 使用 LINQ 转换所有 T 值并将它们分配给不同类型的数组
- svg - 如何将可见伪元素添加到 SVG 路径
- javascript - 是否可以使用 javascript 函数将网站大小调整 1 个像素?