Cascading Style StumblerDiscussion
Centering a layout problem


Winged-FeetNov 14, 2007 9:41pm
Every time I try the standard method for centering a layout, I end up with centered text, too. Including text-align: left; along with the auto right and left margins in the #wrapper isn't overriding the text-align: center; in the body style tag. This is the doctype I'm using: DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" The best I've been able to do is use absolute positioning instead of the standard method. Any thoughts or suggestions?


Sponsor
ThlayliNov 15, 2007 6:21am
Can you provide us with some sample code or a page location? It's hard to guess what went wrong.


Winged-FeetNov 15, 2007 6:41pm
This is a webpage showing my layout attempt at centering using the standard of text-align: center; in the body style tag and text-align: left; in the #wrapper. client.wordwarriorwebdesign.com [client.wordwarriorwebdesign.com]. I'm checking in Firefox version 2.0.0.9 and IE version 6.0. Same problem in both browsers.


PhoenixNoxNov 15, 2007 9:16pm
Your #wrapper ends before it even starts, so your text-align: left; doesn't apply to any content.
Tip, indent your code! Also, you can style the html tag.

There is no reason at all that you should have to use text-align to align block content... I strongly suggest that you remove it and just go with the margin way.


Sponsor
ThlayliNov 16, 2007 6:00am
The main problem seems to be the lack of an 'id="wrapper"' attribute in the appropriate DIV.


Winged-FeetNov 16, 2007 7:37pm
Thanks so much for your advice. Trying to apply book or internet examples to what I'm doing when I haven't grasped the basic concept is a challenge. I just re-visited my wrapper and DIV, and now I'm on the right track.


Centering a layout problem

You need to Sign-up for StumbleUpon to post to this forum