我有以下代碼,它在Chrome和IE中按預期工作。然而在Firefox中,每個按鈕中的第二個跨度顯示在它自己的行中。爲什麼是這樣?這怎麼解決?元素將不會在按鈕彈性容器中彼此靠近對齊
https://jsbin.com/banafor/4/edit?html,css,output
期望(在IE,鉻作品):
失敗(在Firefox):
.buttons-pane {
width: 150px;
height: 400px;
}
button {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
button .title {
background-color: yellow;
}
button .interest {
background-color: lightyellow;
}
<div class="buttons-pane">
<button type="button">
<span class="title">Neque porro quisquam est qui dolorem ipsum quia dolor sit amet</span>
<span class="interest">Short</span>
</button>
<button type="button">
<span class="title">Neque porro quisquam</span>
<span class="interest">LongInterest</span>
</button>
<button type="button">
<span class="title">Vix aeterno vocibus vituperatoribus eu. Nec regione fuis</span>
<span class="interest">Keyword</span>
</button>
</div>
PS:我不介意改變改變跨度爲別的東西,如果有必要:)
包裝既'span'在'div',然後將css屬性'display:table;'添加到div和css屬性'display:table-cell; vertical-align:middle;'to兩個跨度。鏈接:https://jsbin.com/qiniwozilu/edit?html,css,output –