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.
To place an element on the right hand side of the page just put it there
position:absolute;
right:0;
width:200px
Or float it there:
float:right:
width:200px;
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" "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)">
<html xmlns="[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">
<head>
<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}
#right{
width:200px;
background:#ffffcc;
border:1px solid #fff;
position:absolute;
right:0;
top:220px
}
#right2 {
width:200px;
float:right;
height:200px;
background:red;
}
</style>
</head>
<body>
<div id="right2">
<p>This is some right content : This is some right content</p>
</div>
<div id="right">
<p>This is some right content : This is some right content</p>
</div>
</body>
</html>