2013-12-11 347 views
0

我在將div放置在屏幕右側時遇到了問題。這是我的代碼片段。 爲HTML如何在html右側放置div

<div id="bannerR"> 
<a href="google.comtarget=_blank> 
<img src="google.com" border=0></a> 
</div> 

和這裏是我對的.css

#bannerR { position: relative; right; } 

請幫助。謝謝

+1

#bannerL { 位置:相對; float:right; } – Karuppiah

回答

0

float:right;在CSS應該做的伎倆

#bannerL { position: relative; float: right; } 
0
#bannerL{ position: relative;top:0; right:0; } 
1
#bannerL 
    { 
    position: relative; 
    float: right; 
    } 

加浮動:權利;

0

HTML:

<div id="bannerL"> 
<center> 
<a href="http:google.com"> 
<img src="google.com" 

width="468" height="60"> 
</a></center> 
</div> 

CSS:

#bannerL{ position: relative; right:0; top:0; } 
0

看看這個小提琴 http://jsfiddle.net/dd63m/14/的現場演示

<style> 
#bannerL{ position: relative; 
    float:right; } 
</style> 

<div id="bannerL"> 

<a href="http:google.com"> 
<img src="google.com" 

width="468" height="60"> 
</a> 
</div> 

希望這有助於

0

因此,這裏的工作代碼:

HTML:

<div id="bannerL"> 
<center> 
<a href="http:google.com"> 
<img src="google.com" width="468" height="60"> 
</a></center> 
</div> 

CSS:

#bannerL{ position: relative; float:right; } 

現場演示:http://jsfiddle.net/M2smA/1/

0

沒有有效的CSS屬性是這樣的:position: relative; right;

如果您想將Element移動到右側。您可以使用CSS float屬性。

CSS:

#bannerL { 
    position: relative; 
    float: right; 
} 

Try in Fiddle

0
<html> 
    <head> 
     <style> 
      .container{ 
       border: 1px solid blue; 
       text-align: right; 
      } 
      .logo{ 
       border: 1px solid red; 
       background-color: gray; 
       display: inline-block; 
       padding: 15px; 
      } 
     </style> 
    </head> 
    <body> 
     <hr> 
     <div class="container"> 
      <div class="logo"> 
       LOOOGO 
      </div> 
     </div> 
     <hr> 
    </body> 
</html>