在以下示例https://codepen.io/centem/pen/GQVGmw中,我试图将具有数字的div放在以.centered类为中心但它不居中。我如何将它们居中,以便它们位于行的中间而不是左侧?
CSS:
.centered {
margin: 0 auto;
}
的DIV:
<div class="row">
<div id="83" class="square centerd">83</div>
<div id="84" class="square centered">84</div>
<div id="85" class="square centered">85</div>
</div>
答案 0 :(得分:2)
简单:
<div class="row justify-content-center">
<div id="83" class="square centerd">83</div>
<div id="84" class="square centered">84</div>
<div id="85" class="square centered">85</div>
</div>