Dolphin123
12-07-2005, 10:23 AM
or something like that. Don;t know what to search for on this one.
Anyway. The basic problem is I would like to create a center aligned main div. With this code that is possible, however, when the content in the center_content div runs longer than the page, the browser scrollbar pushes the global div to the left. :rolleyes:
How do I fix this? I want the the website to be centered, but not to frigging jump :eek: if the content happens to be longer. Want to stay away from scrollable divs. Cheers :)
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="global">
<div id="banner"></div>
<div id="centercontent"></div>
</div>
</body>
</html>
CSS
body {
font:12px/1.2 Verdana, Arial, Helvetica, sans-serif;
text-align:center;
margin:0px 0px 0px 0px;
padding:0px;
background:#FFF;
}
#global {
margin-left:auto; margin-right: auto;
width:500px;
text-align: left;
}
#banner {
margin-left:0px;
height:50px;
background-color:#fff;
}
#centercontent {
margin-top: 0px;
width:600px;height:90%;
background-color:#fff;
}
Anyway. The basic problem is I would like to create a center aligned main div. With this code that is possible, however, when the content in the center_content div runs longer than the page, the browser scrollbar pushes the global div to the left. :rolleyes:
How do I fix this? I want the the website to be centered, but not to frigging jump :eek: if the content happens to be longer. Want to stay away from scrollable divs. Cheers :)
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="global">
<div id="banner"></div>
<div id="centercontent"></div>
</div>
</body>
</html>
CSS
body {
font:12px/1.2 Verdana, Arial, Helvetica, sans-serif;
text-align:center;
margin:0px 0px 0px 0px;
padding:0px;
background:#FFF;
}
#global {
margin-left:auto; margin-right: auto;
width:500px;
text-align: left;
}
#banner {
margin-left:0px;
height:50px;
background-color:#fff;
}
#centercontent {
margin-top: 0px;
width:600px;height:90%;
background-color:#fff;
}