RE: align="center"

Gannon,

I think you have something there.  I looked up the text-align property and it turns out that it affects any block level element.  This turns out to be very cool because <body>, <div> and a bunch of other elements are block level elements.  So, I think you and Ian just gave me my answer.

My goal is to be able to get the same effect align has centering tables( <table align="center"> ), but with the <div>.  Since "align" is deprecated, it took a tiny trick using the text-align property, not on <div>, but on <body>.  If you use it directly on <div> you just get a bunch of centered stuff.  So, I moved it up to <body>. 

It *was* necessary to set the margins to auto, so, Ian, I took your recomendation, too.   A little here, a little there and you have a <div> that centers properly.  Hope I didn't break any rules.

<body style="text-align : center; color : white; background-color : #333344;font-family : Verdana, Tahoma, Helvetica, sans-serif; font-size:1.5em;color:#222222;">
 <div style=" width:400px;text-align:left; background-color:#ffffff;margin-right : auto; margin-left : auto;" >
<p>Lorem ipsum dolo sit amet, sit a, consectetuer adipiscing elit, sit a, diam nonummy nibh uismo sit a, cidunt ut laoreet dolore mag sit a, aliquam erat volutpat.</p>
</div>
</body>

I guess I should check my work by  validating this.

Steven B.

Received on Sunday, 22 September 2002 07:12:07 UTC