Jump to content

centre layout


RobinTibbs

Recommended Posts

Easy 3 step process:

1. Decide on how wide you want your layout to be.

2. Place a text-align: center; on your body

3. Set a wrapper div (I usually actually call it id="wrapper") around your entire content with your centering CSS:
[code]
#wrapper {
  text-align: left; /* To offset the center of the body */
  margin: 0 auto; /* This is the key (right and left auto margins) */
  width: 760px; /* Or however wide you decided in step one */ 
}
[/code]

That's really all there is to it. Hope this helps!
Link to comment
https://forums.phpfreaks.com/topic/34882-centre-layout/#findComment-164429
Share on other sites

[quote author=jcombs_31 link=topic=123140.msg508609#msg508609 date=1169219908]
The text alignments are not needed.  Just set the auto margin and the width.
[/quote]

The text alignments [b]are[/b] needed for some non-mainstream browsers.

It acts as a safety net more than anything else... although jcombs_31 is right that for IE 5+ and FF, it is not needed.
Link to comment
https://forums.phpfreaks.com/topic/34882-centre-layout/#findComment-164483
Share on other sites

I've had problems with IE5, Netscape, AOL, Konqueror and IE5 Mac at different times, and that safety net has fixed it for me in every case. Grant it, it may have been caused by other display elements in the CSS, but having that as a safety net fixes it nonetheless, so I'm adamant about recommending people to use that as a precaution in their displays.
Link to comment
https://forums.phpfreaks.com/topic/34882-centre-layout/#findComment-164499
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.