Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.