2013-08-06 127 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

我觉得有一些简单的解决方法,谢谢! –