我是引导程序和学习新事物的新手,我正在尝试将引导程序按钮带到底部位置的屏幕中心,到目前为止我的代码是
.bottom-center {
position: absolute;
bottom: 0;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<p>Just a test of placing the button in center of the screen at bottom position</p>
<div class='bottom-center'>
<button type='button' class='btn btn-primary btn-large btn-start'>Center</button>
</div>
答案 0 :(得分:1)
不需要任何额外的 CSS 来实现这一点。
fixed-bottom
类添加到按钮容器以使其位于屏幕底部。d-flex justify-content-center
添加到按钮容器以使其居中阅读有关 bootstrap 中的 flex 属性的更多信息 here
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<p>Just a test of placing the button in center of the screen at bottom position</p>
<div class="fixed-bottom d-flex justify-content-center">
<button type='button' class='btn btn-primary btn-large btn-start'>Center</button>
</div>