...

View Full Version : Centering layout problems



Throlkim
01-02-2008, 12:45 AM
Ahoy. As a note, I hate divs. They're far more complicated than tables to use for layouts, never do what I expect, and it has taken me all day to get this far.
I've built my layout in Photoshop and exported it in div slices. Unfortunately it's positioned absolutely, and I want it centered. It's a fixed width layout, and I haven't bothered altering it much from its exported state yet, as I don't want to get too far implementing it only to realise that I just can't do this with divs.

If you need to see the layout, it's at http://www.subtle-edge.com. I'd be most grateful for any help anybody could give me! :)

Excavator
01-02-2008, 02:06 AM
#Table_01 {
margin: 0 auto;
width:1024px;
position: relative;
}

That should center it. margin: 0 auto; is the bit that centers, position: relative; makes all that absolute positioning work inside #Table_01...

Throlkim
01-02-2008, 04:04 AM
Hurrah! Many thanks! That's saved me no end of bother and annoyance. I was confused by what the position attribute applied to methinks.

Again, thank you very much for the help! :D
Maybe I'll get the hang of div layouts eventually. :)

effpeetee
01-02-2008, 08:44 AM
Again, thank you very much for the help!
Maybe I'll get the hang of div layouts eventually.
If you do! Please let me into the secret.:D

Frank

ahallicks
01-02-2008, 04:07 PM
Hurrah! Many thanks! That's saved me no end of bother and annoyance. I was confused by what the position attribute applied to methinks.

Again, thank you very much for the help! :D
Maybe I'll get the hang of div layouts eventually. :)

I think after a while you will certainly find that layouts not created with tables are so much easier than those created with because firstly there will be plenty less code to crawl through in search of errors. They are also more easily controlled by style sheets as they are what style sheets were made to style.

Think of layouts using divisions as exactly what they sound like they should be... divide the page up into it's separate parts. That should be all you need for a 'div' layout, usually no more than 5 or 6 divs are really needed for a layout with a few bits and pieces. All of the other sections of your page should be in their own relevant tags such as lists inside <ul>'s and paragraphs inside <p>'s. Get your head around semantics and things will fit easily and you'll winder why you ever thought to use a table in the first place :-)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum