的中心,使我有這樣的HTML的按鈕不動,以事業部
<div class="title" id="questionTitle">
<input type="button" class="button green" value="Save"/>
<input type="button" class="button blue" value="Preview"/>
<input type="button" class="button yellow" value="Save And Exit"/>
<input type="button" class="button red" value="Exit Without Saving"/>
</div>
和我想的按鈕位置,這樣他們將在.title僞div的中心。
我的CSS是
.button{
top:50%;
left:50%;
height:30px;
-moz-border-radius:10px;
border-radius:10px;
font-family:Arial;
font-weight:normal;
position:absolute;
top:50%;
}
.title{
-moz-border-radius:15px;
border-radius:15px;
width:30%;
height:100px;
background:#BDBDBD;
}
當我的位置是:絕對的,在頁面的中心,這對我來說沒有任何意義的所有elems的位置,因爲每個.button的祖先都是一個id爲questionTitle的div,所以它應該相對於這個定位。
爲什麼按鈕位於頁面的中心,以及如何使它們位於div的中心?