2012-02-04 119 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; 
} 

这将确保图像将相对于绝对定位,以他们的集装箱。

相关问题