2012-08-13 82 views
1

你好,所以我有Div和裏面它我有5個圖像按鈕和按鈕定位從CSS如何告訴他們在內部div不是整個頁面的位置?圖像按鈕裏面的div位置

<div> 
       <asp:ImageButton CssClass="imgBtn1" ID="ImageButton1" runat="server" ImageUrl="~/zgaszona.png" OnClick="ImageButton1_Click" Enabled="False" /> 
       <asp:ImageButton CssClass="imgBtn2" ID="ImageButton2" runat="server" ImageUrl="~/zgaszona.png" OnClick="ImageButton2_Click" Enabled="False" /> 
       <asp:ImageButton CssClass="imgBtn3" ID="ImageButton3" runat="server" ImageUrl="~/zgaszona.png" OnClick="ImageButton3_Click" Enabled="False" /> 
       <asp:ImageButton CssClass="imgBtn4" ID="ImageButton4" runat="server" ImageUrl="~/zgaszona.png" OnClick="ImageButton4_Click" Enabled="False" /> 
       <asp:ImageButton CssClass="imgBtn5" ID="ImageButton5" runat="server" ImageUrl="~/zgaszona.png" OnClick="ImageButton5_Click" Enabled="False" /> 
</div> 

// CSS樣式

body { 
} 
.imgBtn1 { 
position:absolute; 
right:0%; 
bottom:50%; 
top:50%; 
} 
.imgBtn2 { 
position:absolute; 
right:25%; 
bottom:50%; 
top:50%; 
} 
.imgBtn3 { 
position: absolute; 
right:50%; 
bottom:50%; 
top:50%; 
} 
.imgBtn4 { 
position:absolute; 
right:75%; 
bottom:50%; 
top:50%; 
} 
.imgBtn5 { 
position:absolute; 
bottom:50%; 
top:50%; 
left:0%; 
} 

回答

7

在div的位置必須被設置爲相對

#div_id { 
position: relative; 
}