View Full Version : centering absolute(nested) DIV layers


Juststranded
11-26-2006, 12:33 AM
I want to center my layout without using frames. It's driving me crazy.

I have 9 layers; 1 parent and 8 nested.


---------------------------
<div id="main">


<div id="banner_bottom"><img src="graphics/banner_bottom.png" alt="banner_bottom"/></div>

<div id="nav_bar"><img src="graphics/nav_bar.png" alt="nav_bar" border="0" usemap="#Map" />
<map name="Map" id="Map">
<area shape="rect" coords="-1,-4,38,19" href="home.html"/>
</map></div>
<div id="banner_1"><img src="graphics/banner_1.gif" alt="banner_1" /></div>
<div id="banner_2">
<center><img src="graphics/banner_2.gif" alt="banner_2" width="50" height="84" /></center></div>
<div id="banner_3"><img src="graphics/banner_3.gif" alt="banner_3" /></div>
<div id="banner_top"><img src="graphics/banner_top.png" alt="banner_top" /></div>

<div id="categoryTable">table</div>

</div>

----------------

All are set as to absolute positioning, including #main (the parent) because Dreamweaver just won't let me nest them if they aren't all set to absolute.

The whole layout looks great but it's aligned to the left side of te screen.

pb&j
11-26-2006, 09:36 AM
you can't center something that has absolute positioning. it is one or the other. check out this on centering...

http://www.lissaexplains.com/forum/showthread.php?t=59782

J to the izzosh
11-26-2006, 01:13 PM
The first method in that tutorial will show you how to center your absolutely positioned parent. ;)