0
這裏是我的基本的HTML垂直對齊的div:無法使用Flexbox的
<div class="col-lg-12">
<div class="col-lg-4 center-block main-text center-text marg-small boxed">
<div class="random">Some Text</div>
<div class="col-lg-6 marg-small ">
<div id="pick_channel" class="boxed orange">
<div class="square vertical">Channel</div>
</div>
<div id="pick_objective" class="boxed orange">
<div class="square vertical">Objective</div>
</div>
</div>
</div>
</div>
和相關的CSS:
.boxed{
display:flex;
flex-direction: column;
flex-wrap:nowrap;
align-items: center;
}
.square {
height:100px;
width:100%;
display:flex;
align-self:center;
margin-bottom: 10px;
}
.vertical{
}
我試圖與id
小號pick_channel
和pick_objective
爲矩形落得文字「Channel」和「Objective」以其各自的divs
垂直和水平居中。我嘗試了一堆組合,但無法弄清楚。
謝謝!這幾乎是完美的。我如何將我的'col-lg-4' div中的所有這些盒子對齊? – jonmrich
好吧我編輯它現在看起來很奇怪,但與自舉類它應該工作 –