Help me with this CSS box model problem!
May 26, 2004 8:59 PM
Subscribe
CSS question. Usually, I can figure these things out. This one has me stumped. I know its a box model problem, but none of the usual fixes seem to fix it. Everything looks right in Mozilla, Firefox, and Opera. Bigger, better explanation inside, along with some code.
OK. Here's the code:
<!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" xml:lang="en">
<head>
<title>Moron</title>
<style type="text/css">
body {
top: 0px;
left: 0px;
background:black; /*#ECEED9;*/
text-align: center;
font-size: 12pt;
}
#center {
text-align: center;
padding: 0px;
}
#page {
background: white;
margin-top: 50px;
margin-bottom: 50px;
width: 867px;
height: 1194px;
border: 1px solid red;
padding: 0px;
}
#textblock {
background: white;
padding: 0px;
margin-left: 313px;
margin-right: 89px;
margin-top: 89px;
margin-bottom: 133px;
width: 465px;
height: 972px;
border: 2px solid green;
}
.wrap {
text-align: left;
border: 3px solid red;
}
#leftcol {
border: 2px solid green;
position: absolute;
top: 89px;
left: 2em;
background: #F7F4EB;
width: 135px;
height: auto;
padding: 0px;
margin-left: 2em;
margin-top: 89px; /*added*/
margin-bottom: 133px; /*added*/
text-align: left; /*added*/
}
#header {
position: absolute;
width: 865px;
background: white;
border: 1px solid blue;
font-family: "bitstream vera sans mono", "courier new", courier, mono-space;
font-variant: small-caps;
font-size: 8pt;
letter-spacing: 0.1em;
margin: 12px 0 0 0;
padding: 0px;
}
#foot {
position: absolute;
top: 1215px;
width: 865px;
background: white;
border: 1px solid blue;
font-family: "bitstream vera sans mono", "courier new", courier, mono-space;
font-variant: small-caps;
font-size: 7pt;
letter-spacing: 0.1em;
}
</style>
</head>
<body>
<div id="center">
<div id="page">
<p id="header">this is the header</p>
<div id="textblock">
<div class="wrap">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut risus. Aenean porta urna ac ligula luctus tincidunt. Aliquam ullamcorper lorem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas mollis urna ac arcu imperdiet sodales. Phasellus mattis tempus sem. Donec dui. Curabitur varius volutpat pede.</p>
</div>
</div>
<div id="leftcol">
<ul>
<li>link1</li>
<li>link2</li>
</div>
<p id="foot">this is the footer</p>
</div>
</div>
</body>
</html>
posted by Grod to computers & internet (11 comments total)
The borders, by the way, are just so I can visualize what I'm doing.
See it in action here
I can fix the textblock problem by adding this:
* html #textblock {
position: relative;
top: 89px !important;
}
but I'm not certain what to do about the header and footer, or the disapearing margin below the #page box.
posted by Grod at 9:11 PM on May 26, 2004