Click here to get back home

center align a page

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
center align a page Jeff Thies 08-05-2005
Posted by Jeff Thies on August 5, 2005, 2:27 am
Please log in for more thread options


I've got a page with content that I want aligned in the center, with
equal margins on both sides (text, left aligned).

It seems to me that this is a complex thing to get right on most
browsers and required putting the page in a div and then body:
textalign: center
and a few other hacks

There was a site that explained this rather well but I can't seem to
google it up. Where is that?

The page in question is fixed width and image heavy (photos) so it
escapes the normally very good reasons to not center align.

Cheers,
Jeff

Posted by Jim Moe on August 4, 2005, 10:12 pm
Please log in for more thread options


Jeff Thies wrote:
> I've got a page with content that I want aligned in the center, with
> equal margins on both sides (text, left aligned).
>
div.body { margin-left: auto; margin-right: auto; }
No hacks needed. Even works in IE6.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

Posted by Els on August 5, 2005, 9:14 am
Please log in for more thread options


Jim Moe wrote:

> Jeff Thies wrote:
>> I've got a page with content that I want aligned in the center, with
>> equal margins on both sides (text, left aligned).
>>
> div.body { margin-left: auto; margin-right: auto; }
> No hacks needed. Even works in IE6.

If you want it to work in WinIE5 too:
http://locusmeus.com/html-css/centeringpage.html

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -

Similar ThreadsPosted
Center align a DIV without
tags
June 18, 2008, 9:43 am
IFrame align="center" in Netscape and Firefox May 17, 2005, 4:41 pm
Center Web Page Not Working July 23, 2008, 1:30 am
Newbie question: css layout with 3 columns (left align, use all remaining space, right align) March 29, 2006, 10:36 pm
How to center content in div tag? December 9, 2004, 8:52 pm
Frame, table, and center August 31, 2007, 5:51 am
center an image inside a div February 24, 2008, 6:03 pm
Center-Aligning elements May 12, 2008, 12:41 am
center a picture in the middle of a paragraph December 2, 2004, 10:14 pm
Frontpage problem/ using css to center TABLE - help...! June 15, 2005, 1:05 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap