Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 为什么列不在引导程序5中居中?_Twitter Bootstrap_Bootstrap 5 - Fatal编程技术网

Twitter bootstrap 为什么列不在引导程序5中居中?

Twitter bootstrap 为什么列不在引导程序5中居中?,twitter-bootstrap,bootstrap-5,Twitter Bootstrap,Bootstrap 5,在Bootstrap 5中,为什么柱之间的间距不相等?下面是代码和fiddle链接 它们没有居中,因为.text center不会以与文本相同的方式影响列。您需要使用.justify资源中心。它们之间没有任何间距,因为您正在将自己的自定义CSS应用于.col-*属性,并添加边框和填充 您还将.container应用于在任何版本的引导中都无效的.row。通过更正CSS声明并将每个列的内容包装到元素中以容纳所需的填充/背景样式,您可以实现目标 信件 A. B C D E F G H 哦,我没有注意

在Bootstrap 5中,为什么柱之间的间距不相等?下面是代码和fiddle链接


它们没有居中,因为.text center不会以与文本相同的方式影响列。您需要使用.justify资源中心。它们之间没有任何间距,因为您正在将自己的自定义CSS应用于.col-*属性,并添加边框和填充

您还将.container应用于在任何版本的引导中都无效的.row。通过更正CSS声明并将每个列的内容包装到元素中以容纳所需的填充/背景样式,您可以实现目标

信件 A. B

C D

E F

G H


哦,我没有注意到JSFIDLE添加了自定义css边框和填充。很好,你指出了这一点。
<section>
  <div class="row text-center mb-5">
    <div class="col">Letters</div>
  </div>
  <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3 text-center container">
  <div class="col">
    <h2>A</h2>
    <p>B</p>
    <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
  </div>
  <div class="col">
    <h2>C</h2>
    <p>D</p>
    <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
  </div>
  <div class="col">
    <h2>E</h2>
    <p>F</a></p>
    <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
  </div>
  <div class="col">
    <h2>G</h2>
    <p>H</p>
    <p><a class="btn btn-secondary" href="#" role="button">View details &raquo;</a></p>
  </div>
</div>