2013-08-06 129 views
3

我有三個按鈕開始,中止和關閉。你能告訴我怎樣才能讓開始和中止按鈕正好到達DIV的中心,然後關閉按鈕到右側。當我使用float:right啓動和中止按鈕對齊的休息空間:(將按鈕中心右對齊

<div style="text-align: center; width: 100%; border-width: 1px 0 0 0; "> 
        <button id="btn-continue-top-fill">Start</button> 
        <button id="btn-cancel-top-fill">Abort</button>      
        <button id="btn-close-top-fill" style="float: right;">Close</button> 
</div> 

回答

7

您可以使用position:absolute以確保關閉按鈕不干擾定心。

<div style="text-align: center; position:relative; width: 100%; border-width: 1px 0 0 0; "> 
    <button id="btn-continue-top-fill">Start</button> 
    <button id="btn-cancel-top-fill">Abort</button>      
    <button id="btn-close-top-fill" style="position: absolute; right: 0;">Close</button> 
</div> 

中心小提琴:http://jsfiddle.net/zc7m5/1/

+0

我覺得有一些簡單的解決方法,謝謝! –