为什么 Bootstrap 网格中的内容向左浮动?有没有办法让 Bootstrap 网格中的内容位于中心?
Why do the contents in a Bootstrap grid float left? Is there a way to get the contents in a Bootstrap grid to be in the center?
我试过使用 text-align: center;
,但这不会更改 Bootstrap 网格内的文本。 float-left 是默认设置还是我可以更改它?我的代码看起来像这样:
<div style="margin-top: 10px; margin-bottom: 20px; margin-right: 20%; margin-left: 20%; text-align: center; font-family: 'Share Tech Mono', monospace; background-color: white; border-radius: 50px;">
<h1 style="padding-top: 10px;">Code Example</h1>
<br>
<br>
<div class="row">
<div class="col-sm-4 "><a style="color: black;">Column 1</a></div>
<div class="col-sm-4"><a style="color: black;">Column 2</a></div>
<div class="col-sm-4"><a style="color: black;">Column 3</a></div>
<div style="height: 50px;"></div>
</div>
</div>
CSS Copy-paste 在所有其他样式表加载我们的 CSS 之前将样式表放入您的样式表中。
''''''
如果您遗漏了这个 link 请添加。我希望它会起作用。
刚发现padding-left
可以用。不确定这是否是最佳解决方案,但至少是这样。
我试过使用 text-align: center;
,但这不会更改 Bootstrap 网格内的文本。 float-left 是默认设置还是我可以更改它?我的代码看起来像这样:
<div style="margin-top: 10px; margin-bottom: 20px; margin-right: 20%; margin-left: 20%; text-align: center; font-family: 'Share Tech Mono', monospace; background-color: white; border-radius: 50px;">
<h1 style="padding-top: 10px;">Code Example</h1>
<br>
<br>
<div class="row">
<div class="col-sm-4 "><a style="color: black;">Column 1</a></div>
<div class="col-sm-4"><a style="color: black;">Column 2</a></div>
<div class="col-sm-4"><a style="color: black;">Column 3</a></div>
<div style="height: 50px;"></div>
</div>
</div>
CSS Copy-paste 在所有其他样式表加载我们的 CSS 之前将样式表放入您的样式表中。 '''''' 如果您遗漏了这个 link 请添加。我希望它会起作用。
刚发现padding-left
可以用。不确定这是否是最佳解决方案,但至少是这样。