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,
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; .
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.
the style is:
<style type="text/css"> .topcorner{ position:absolute; top:0; right:0; } </style>
hope it will work. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With