當我嘗試將一個元素放在左上角而另一個放在中間時,頂層元素不會一直放到剩下。我該如何做到這一點?使用flexbox將一個元素對齊頁面左上角和中間的一個元素
.Aligner {
background-color: blue;
display: flex;
align-items: center;
justify-content: center;
height: 200px;
}
.Aligner-item {
max-width: 50%;
background-color: green;
}
.Aligner-item--top {
align-self: flex-start;
}
<div class="Aligner">
<div class="Aligner-item Aligner-item--top">…</div>
<div class="Aligner-item">…</div>
<div class="Aligner-item Aligner-item--bottom">…</div>
</div>
http://codepen.io/anon/pen/EVjzzo
你如何期待這個看? –
請發佈您的輸出樣機。我想泰勒就在這裏。 –
'justify-content:center;' - >'justify-content:space-between;'。查看[css技巧](https://css-tricks.com/almanac/properties/j/justify-content/)瞭解更多信息。 – Lars