Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Absolute Positioned Layers to Center on Page

Status
Not open for further replies.

Actorial

Programmer
Aug 23, 2006
38
0
0
US
Ok I'm using DW 8, and I have many layers positioned using absolute coordinates. The problem is I would like to have the whole site display centered no matter what browser size or type you have.

Is there a way to convert abs. positioned layers so that they are still in the same positions relative (nested?) to each other but the whole design is centered on page?

I've used margin: 0 in the CSS tags on other sites for a surrounding layer, and then use a table within that centered layer, but tables are really inconvenient to use. My goal here is not to have to muck with the all the layers individually.

 
Hi

I centre all my pages in css with margin auto auto; , in theory if you have all your layers nested in side each other then if you position your content layer with css and margin auto auto; then that should cure your problem



hope this helps



paul....


 
hmm it doesn't really work, as soon as you remove the position absolute tag and replace it with margin:auto auto
the layer center but any nested layers still retain their absolute positioning.

one would expect that you just set the pixel postioning relative to one floating layer that remains centered and therefore tells all the other layers where to be. It just seems wierd that it is so hard to find any information on this stuff.

 
OK! THE SOLUTION!!! I've been wanting to do this for years!

Go to:
Download the Layout Designer II and Auto Layers Dreamweaver Extensions, and then install them.

Do a screen centering with your layer to be centered on the screen using Layout Designer II in the behaviors panel with the <body onload> event.

Then simply nest all your layers using the layers panel in Dreamweaver. (Ctrl-click and drag the layers to nest onto the centered layer)

Bam! Your whole site is centered and you never had to change your layer positions! You'll prolly want to using the Suto Layers extension to hide the layers until they load so they don't jump wildy into position for the user. Cross-platform cross-browser solution!

If you have questions let me know, I worked through this for many hours, and it sucked, save yourself some headbanging.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top