【发布时间】:2019-04-27 09:25:49
【问题描述】:
我正在编写以下代码:
.positiones {
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}
<div class="positiones">
<div class="mainheading">
<h1>The biggest startup event of the year!</h1><br>
</div><br>
</div>
<div class="linebreak"></div><br>
<div class="Button">
<button type="button" class="btn btn-primary btn-lg">Get more info</button><br>
</div>
如您所见, justify-content 属性不起作用。
好吧,我需要一些帮助,谢谢你:)
【问题讨论】:
-
你说的是按钮吗?
-
您的代码运行良好。你有一个弹性容器
positiones,其中有一项mainheading。你到底想以什么为中心?h1或h1&button? -
justify-content工作正常。mainheading有理由居中。您期待什么行为?