【发布时间】:2018-01-18 05:18:56
【问题描述】:
我的h1 只有在其下方有足够的文本时才会与屏幕中心对齐。否则,它将对齐错误/根本不对齐。我该如何解决这个问题?
.content {
margin-top: 60px;
text-align: center;
}
body {
background-color: #a8a8a8;
}
.textbox {
background-color: white;
padding: 20px 100px 100px 100px;
}
<div class="container textbox">
<div class="row">
<div class="col-xs-12 content">
<h1>Contact</h1>
</div>
</div>
</div>
以下是我提到的每种情况的屏幕截图:
A bit of text underneath the h1
Enough text underneath the h1 (the h1 finally aligns properly)
【问题讨论】:
-
用额外的文本显示您的标记,以便我们知道您在做什么。
-
什么浏览器?在 IE11 中对我来说很好;
<h1>即使下面没有文字也会对齐。
标签: html css alignment bootstrap-4