Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to place div in top right hand corner of page

Tags:

html

css

How do you float a div to the top right hand corner of a page using css? I want to float the topcorner div which is below:

<p><a href="login.php">Log in</a></p>  <div class="topcorner"><a href="home.php">Back to Home</a></div> 

log in goes in left hand corner which it does at moment, I want home link to be placed in other corner,

like image 571
user1914374 Avatar asked Jan 09 '13 08:01

user1914374


People also ask

How do you put a div in the top right corner?

you can play with the top and right properties. If you want to float the div even when you scroll down, just change position:absolute; to position:fixed; .

How do I keep a div at the top of the page?

The vertical position of the element to be stuck can also be modified with the help of the 'top' property. It can be given a value of '0px' to make the element leave no space from the top of the viewport, or increased further to leave space from the top of the viewport.


1 Answers

the style is:

<style type="text/css">  .topcorner{    position:absolute;    top:0;    right:0;   } </style> 

hope it will work. Thanks

like image 68
Shah Rukh Avatar answered Sep 20 '22 21:09

Shah Rukh