一.container
<div class="container" id="demo"> <h1>hello~</h1></div>#demo.container{ background: blue; height: 100vh; color: white;}
重点:
container置中的话宽度缩小,container的宽度也会缩小
二.container-fluid
<div class="container-fluid" id="demo"> <h1>hello~</h1></div>#demo.container-fluid{ background: blue; height: 100vh; color: white;}
重点:
container-fluid为流动置中,也就是说这里的左右内留白都固定在15px
codepen
参考:bootstrap4