Software Development
Blogs and Discussion
developer.*
Books Articles Blogs Subscribe d.* Gear About Home

Center Align a Main Content div in All Browsers

Editor's note: after a friendly reader (see comment below) pointed out that this article was a pretty much word-for-word copy of another article, we have removed the text of the original article posted here and instead direct you to the article that was copied, "CSS Crib sheet #3 - Centering a Div," by Andy Budd.

We apologize for this incident. Plagiarism is something we take seriously, and appreciate the opportunity to correct this issue on our site.

Sincerely,
Daniel Read

Thanks

Great subject, one that many sites try to cover - this seems to be the answer - works fine.

In my experience, you can

In my experience, you can also add the XHTML Transitional doctype to your document, which then causes IE to render correctly.

My Solution for aligning centre

I always have a wrapper div called page so,

#page
{
position: relative;
left: 50%;
margin-left: -400px;
width: 800px;
}

Ok, so it's for fixed width sites, but thus far this has worked in every scenario I've come across.

Interesting article. Looks a

Interesting article. Looks a bit like one Andy Budd posted two years ago. Hmmm...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

User login

About our advertising.

Atom Feed

developer.* Blogs also has an Atom feed, located at this url.

Click here for more information about Atom.

A Jolt Award Finalist
Software Creativity 2.0
Foreword by Tom DeMarco

Recent Posters

Based on most recent 60 days, sorted by # of posts and name.

Google
Web developer.*

Who's online

There are currently 0 users and 23 guests online.

Syndicate

Syndicate content
All views expressed by authors, bloggers, and commentors are their own and do not necessarily reflect the views of developer.* or its proprietors.
Click to read the Copyright Notice.

All content copyright ©2000-2005 by the individual specified authors (and where not specified, copyright by Read Media, LLC). Reprint or redistribute only with written permission from the author and/or developer.*.

www.developerdotstar.com