2012-02-04 70 views
0

我怎樣才能用CSS對齊兩個圖像,一個在Upper Rigth位置,另一個在向下位置?如何將CSS與兩個圖像對齊,一個位於Upper Rigth位置,另一個位於Down-Right位置?

這裏是標記

<th class="X" scope="col"> 
Time 
<input id="ORAAsc" class="up" type="image" style="border-width:0px;" src="" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$ORAAsc"> 
<input id="Desc" class="down" type="image" style="border-width:0px;" src="" name="ctl00$ContentPlaceHolder1$GridView1$ctl02$ORADesc"> 
</th> 

和CSS

.X { 
    height:33px; 
    background-color:#DEDEDD; 
    width:75px; 
    bottom:0; 
    top:0; 
    left:0; 
    right:0; 
    margin-top:20px; 
    margin-bottom:20px; 
    margin-right:80px; 
    margin-left:80px; 
} 





.up{What should i place here?} 

.down{What should i place here?} 

謝謝您的時間

+0

您是否試圖在.X中對齊兩個圖像,兩個都在右邊,一個在另一個之上? – Alpaus 2012-02-04 21:56:40

+0

@Alpaus我想將X中的圖像與絕對位置對齊。一個應該堅持右上角,另一個右下角 – OrElse 2012-02-05 13:51:28

回答

0

嘗試

.up { 
top: 0; 
right: 0; 
position: absolute; 
} 

.down { 
bottom: 0; 
right: 0; 
position: absolute; 
} 
+0

「down:0px」 - >「bottom:0」(無需將「px」添加到0) – steveax 2012-02-04 23:59:45

1

jacktheripper是正確的。它通常是一個好主意,使用絕對定位時,另一件事情添加到包含元素:

.x{ 
    position:relative; 
} 

這將確保圖像將相對於絕對定位,以他們的集裝箱。

相關問題