Making a div go down right side of page

How can you make a div place nicely on the right side of the screen without creating a horizontal scroll bar?

I have tried a few things like margin-left: 100%; which just creates a scrollbar. Also I have done things like margin-left:94.1%; it works good in some browsers but in others it doesnt.

The basic model is:-

body = 100%

Content = 90%
right = 10% (or even 9.99%) and float the right div to the right.

Check out the following thread for my help:

or have a look at my layout code (which is just a modified version of the above so I can see it clearer)

Hope that helps in some way.


To place an element on the right hand side of the page just put it there :slight_smile:


Or float it there:


It all depends on what you are trying to achieve. If you want 100% height then look at the links Mikel posted above and look at my 3 col thread which explains 100% height in detail.

Here’s just a basic example of putting something on the right without a scrollbar appearing.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[](">
<html xmlns="[](">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
body {margin:0;padding:0}
 border:1px solid #fff;
#right2 {
<div id="right2"> 
  <p>This is some right content : This is some right content</p>
<div id="right"> 
  <p>This is some right content : This is some right content</p>


thanks guys. Ill look into these

Just know that if you float it there…it will then grow or shrink with the browser window. If the rest of your page allows this, it’s fine.

Another good source for css is Click on their “resources” for lots of info.

it will then grow or shrink with the browser window

I think I should be ok on that since all my divs are measured in percentages not a defined number of pixils. Thanks for the heads up though.