Jump to content

Recommended Posts

text-align center is NOT the best way to do this

 

give your element (in this case body) a width (either % or absolute - like px) and set the lft and right margin to auto in your css...

 

THAT IS THE BEST WAY TO DO THIS

Use {margin:0 auto;} on the outer-most containing element to get every browser playing along.

 

Do not listen to the bad advice that recommends using text-align in the css or the align attribute in the html. Text-align is used to align text and not the layout. It will not work unless you are using quirks mode. The align html attribute is also depreciated.

 

If you need to support IE5.* then put you need to do something specific for that browser. It is best to put this in a conditional stylesheet, but every other browser behaves properly (if you are using a valid doctype) even if this code is included in your general stylesheet.

 

/*In an IE5 stylesheet*/
body {text-align:center;} /*centers layout and text in IE5, only centers text in everything else*/
#wrapper {text-align:left;} /*left aligns your text*/

 

The only bad advice; is the advice that bronzemonkey and TheFilmGod is giving you. Text-align center will work fine for this. I also said that "align=center" will work too; like so:

 

<div align="center">
<!-- Body's Content Here -->
</div>

 

If you want to listen to less experienced coders; go with the two members above. If you want to make this work and go with an experience designer; you should listen to me.

 

I take that extremely offensively. I deserve an apology for such utter rubbish.

 

Anyway, your method isn't wrong. It works too, but align is an HTML declaration that is deprecated, meaning it isn't the ideal solution. If you use standard complaint browsers like Opera 9.50 beta, you will see that such deprecated declarations have no effect on the actually rendering of the website.

 

Your ego and self confidence is the only thing that supports your statement. You can also try to be modest sometimes, most notably when you speak of such outrageous lies.

 

mod edit: the ludicrous post to which this responded has been removed

Most of the people here would rather keep the forums civil, inviting, and helpful to those looking for accurate answers. Unfortunately, phpquestioner, you are resorting to slander and some of your advice is simply misleading or not following best practices. It would be appreciated if you could dispense with the aggressive tone and the attacks against professional developers.

Guest
This topic is now 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.