我想将两个按钮都放在中间,我尝试过margin:0 auto 0 auto;到该位置,但不起作用(当我尝试使用表而不是使用Div定位时,它起作用了。)但我仍然想知道为什么我无法使用div将其居中。
<div class="col-md-9 col-sm-12 service-details">
<h1 class="website-banner">We Just Don't Create Websites, We Create Art.</h1>
<div class="button-container">
<button class="btn btn-lg btn-dark" type="button">
Build My Website
</button>
<button class="btn btn-lg btn-dark" type="button">
Work With Us
</button>
</div>
</div>
谢谢。
.button-container{
display:flex;
justify-content:center;
}
或使用引导实用程序类
<div class="button-container d-flex justify-content-center">