View Full Version : help with divs
Francisco Dias
12-20-2007, 09:51 AM
Hi there, can someone help me out, I'm trying to make a div that goes from top to bottom of the page it starts on the very top and ends at the very bottom (I think it can be archieved with absolute positioning, but is it going to mess with my alignment? since it is centered in the page)
Example:
_____________
| | | |
| | | |
| | | |
| | DIV | |
| | | |
| | | |
|___|_____|___|
Thank you in advance
jscheuer1
12-20-2007, 05:18 PM
Absolute positioning is generally a bad idea for such a major page element. In quirksmode you can set an element's height to 100% and it will fill the window:
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
text-align:center;
margin:0;
padding:0;
}
#main {
width:85%;
height:100%;
background-color:gray;
margin:0 auto;
}
</style>
</head>
<body>
<div id="main"></div>
</body>
</html>
But in standards mode (same basic code as above with a valid URL DOCTYPE) you cannot. It will only be as high as the content within it.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.