我有三個HTML對象,並且想要在左側排列Previous按鈕,在右側排列Next按鈕,並在容器div內部跨越中間。在div中水平對齊HTML元素
<PREVIOUS> |SPAN| <NEXT>
HTML
<div>
<input type="button" value="Previous" id="btnPrevious"/>
<span id="spanStage">Stage 5</span>
<input type="button" value="Next" id="btnNext"/>
</div>
CSS
#btnPrevious
{
float:left;
}
#spanStage
{
font-weight:bold;
vertical-align:middle;
}
#btnNext
{
float:right;
}
你有沒有考慮過使用flexbox? https://css-tricks.com/snippets/css/a-guide-to-flexbox/ – chchrist