user3089861
user3089861

Reputation: 21

How to position a Div on right hand side with html

I am having trouble positioning a div to the right side of the screen. here is my code snippet. for html

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

and here is what i have for .css

#bannerR { position: relative; right; }

please help. thank you

Upvotes: 1

Views: 11167

Answers (8)

Tomislav Petrović
Tomislav Petrović

Reputation: 1

<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> 

Upvotes: 0

Ishan Jain
Ishan Jain

Reputation: 8161

There is no valid CSS property like this : position: relative; right;.

If you want to move Element to right side. You can use CSS float property.

CSS:

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

Try in Fiddle

Upvotes: 0

Ahoura Ghotbi
Ahoura Ghotbi

Reputation: 2896

So here is the working code:

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; }

Live Demo: http://jsfiddle.net/M2smA/1/

Upvotes: 0

Amarnath Balasubramanian
Amarnath Balasubramanian

Reputation: 9460

Check out this fiddle http://jsfiddle.net/dd63m/14/ for Live Demo

<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>

Hope this helps

Upvotes: 0

akash
akash

Reputation: 2157

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; }

Upvotes: 0

Karuppiah RK
Karuppiah RK

Reputation: 3964

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

add float: right;

Upvotes: 1

Sandeep Nayak
Sandeep Nayak

Reputation: 4757

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

Upvotes: 0

asdf
asdf

Reputation: 3067

float: right; in the css should do the trick

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

Upvotes: 0

Related Questions