Forum Moderators: not2easy

Message Too Old, No Replies

centering container block horizontally & vertically

         

gaxet

2:55 am on Nov 19, 2004 (gmt 0)



my website has pages with set width (740px) and varying heights (depending on content). i'm using one div container block to house the others (header, navigation, content, footer).

searching thru the forums, have found out how to center horizontally. how can i "center" my pages so that there is also bgcolor showing on the top and bottom of my div container? here is what i have:

body
{
background-color: #B6DCF0;
}

#container
{ /* overall container box */
background-color: #FFFFFF;
border: solid 1px #000000;
width: 740px;
position: absolute;
top: 0;
left: 50%;
margin-left: -370px;
}

thank you.

djclark

3:07 am on Nov 19, 2004 (gmt 0)

10+ Year Member



this seems to work ok... although only gave a few quick tests...

<style type="text/css">
<!--
#Outer{ width:400px; height:300px; background-color:#0000FF}
#Inner{margin-bottom:15%; margin-top:15%; background-color:#FF0000;}
-->
</style>
</head>
<body>
<div id="Outer">
<div id="Inner">some text </div>
</div>