Forum Moderators: not2easy
I am near tearing my hair out with this one. I have a page set up and want it to appear centered on any res.
When I contain it in a div and center the div it seems to ignore the containing div.
What am I doing wrong?
#header {
position:absolute;
left:0px;
top:15px;
width:795px;
height:176px;
z-index:1;
}
.navtxt {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-size:12px; text-align:center; background-color:#999999;}
#leftnav {
position:absolute;
left:0px;
top:188px;
width:140px;
height:398px;
z-index:2;
}td img {display: block;}
.navside{
padding-top:2px;
background-image:url(images/vlines.jpg);
background-repeat:repeat-y;
z-index:1;
}td img {display: block;}td img {display: block;}
#Curve {
position:absolute;
left:139px;
top:187px;
width:656px;
height:428px;
z-index:3;
background-color: #CCCCCC;
}
#Layer1 {
position:absolute;
left:212px;
top:217px;
width:522px;
height:398px;
z-index:4;
}
-->
</style>
<div id="header">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/header.jpg" alt="Image" width="795" height="150" /></td>
</tr>
<tr>
<td><table width="795" border="0" cellpadding="0" cellspacing="0">
<tr class="navtxt">
<td width="35%">Drainage/Excavation & Driveways</td>
<td width="1%"><img src="images/vdivide.jpg" alt="divide" /></td>
<td width="53%">Effluent Proposals/Septic Tanks & Lifestyle Blocks </td>
<td width="2%"><img src="images/vdivide.jpg" alt="divide" /></td>
<td width="9%">Contact</td>
</tr>
</table></td>
</tr>
</table>
</div>
<div id="leftnav">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="51" bgcolor="#999999"> </td>
</tr>
<tr>
<td bgcolor="#999999" align="center"><table border="0" cellpadding="0" cellspacing="0" width="121">
<!-- fwtable fwsrc="left nav.png" fwbase="left nav.jpg" fwstyle="Dreamweaver" fwdocid = "667647522" fwnested="0" -->
<tr>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0" id="undefined_2" /></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="120" height="1" border="0" id="undefined_2" /></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td colspan="2"><img name="leftnav_r1_c1" src="images/leftnav/left nav_r1_c1.jpg" width="121" height="1" border="0" id="leftnav_r1_c1" alt="" /></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td rowspan="6"><img name="leftnav_r2_c1" src="images/leftnav/left nav_r2_c1.jpg" width="1" height="103" border="0" id="leftnav_r2_c1" alt="" /></td>
<td><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','navbar1','Home','images/leftnav/Home_f3.jpg',1);" onmouseover="MM_nbGroup('over','Home','images/leftnav/Home_f2.jpg','images/leftnav/Home_f4.jpg',1);" onmouseout="MM_nbGroup('out');"><img name="Home" src="images/leftnav/Home.jpg" width="120" height="26" border="0" id="Home" alt="" /></a></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="26" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td><img name="leftnav_r3_c2" src="images/leftnav/left nav_r3_c2.jpg" width="120" height="11" border="0" id="leftnav_r3_c2" alt="" /></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="11" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','navbar1','Contact','images/leftnav/Contact_f3.jpg',1);" onmouseover="MM_nbGroup('over','Contact','images/leftnav/Contact_f2.jpg','images/leftnav/Contact_f4.jpg',1);" onmouseout="MM_nbGroup('out');"><img name="Contact" src="images/leftnav/Contact.jpg" width="120" height="26" border="0" id="Contact" alt="" /></a></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="26" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td><img name="leftnav_r5_c2" src="images/leftnav/left nav_r5_c2.jpg" width="120" height="12" border="0" id="leftnav_r5_c2" alt="" /></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="12" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','navbar1','Furtherinfo','images/leftnav/Furtherinfo_f3.jpg',1);" onmouseover="MM_nbGroup('over','Furtherinfo','images/leftnav/Furtherinfo_f2.jpg','images/leftnav/Furtherinfo_f4.jpg',1);" onmouseout="MM_nbGroup('out');"><img name="Furtherinfo" src="images/leftnav/Furtherinfo.jpg" width="120" height="26" border="0" id="Furtherinfo" alt="" /></a></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="26" border="0" id="undefined_2" /></td>
</tr>
<tr>
<td><img name="leftnav_r7_c2" src="images/leftnav/left nav_r7_c2.jpg" width="120" height="2" border="0" id="leftnav_r7_c2" alt="" /></td>
<td><img src="images/leftnav/spacer.gif" alt="" name="undefined_2" width="1" height="2" border="0" id="undefined_2" /></td>
</tr>
</table> </td>
</tr>
<tr>
<td height="272" bgcolor="#999999"> </td>
</tr>
</table>
</div>
<div id="Curve"><img src="images/curve.gif" alt="curve" width="34" height="34" /></div>
<div id="Layer1">
<table width="100%" border="0">
<tr>
<td><div align="center"><strong>!Content!</div></td>
</tr>
<tr>
<td height="62"> <div align="center">!content!</div></td>
</tr>
<tr>
<td><div align="center"><img src="images/truck1.gif" alt="Truck" width="350" height="247" /></div></td>
</tr>
<tr>
<td><div align="center"><img src="images/needs.gif" alt="needs" width="416" height="34" /></div></td>
</tr>
</table>
</div>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
...
<STYLE TYPE="text/css">
#contain
{
height:100%;
margin-left:6%;
margin-right:6%;
}
</style>
<BODY>
<div id="contain">
put everything in this container
</div>
Gene_B - your solution works fine so long as you want a fluid width. It does not work for a fixed width (without the inclusion (somewhere) of the "text-align: center" (for IE - with the corresponding fix to "text-align: left") and "margin: auto" (for non-IE)).
Nice option for fluid width pages though - thanks.