Re: Centering Whole Block without Centering Text Within Question

by "Tim Rivera" <lists(at)timrivera.com>

 Date:  Sat, 4 Dec 2004 17:50:11 -0500
 To:  "Janet Zagoria" <honeywebster(at)comcast.net>,
"HWG-Style" <hwg-style(at)hwg.org>
 References:  comcast
  todo: View Thread, Original
Hello Janet,

There are two ways to center the content: the CSS way, and the IE way.
To easily center a block with CSS, all you would need to do is give
the block "auto" left and right margins. However, to center in IE,
you'd need to use "text-align: center" for the containing block, and
then "text-align: left" for the centered block.

div.center {
 text-align: center;
 }
div.content {
 width: 70%;
 margin: auto;
 text-align: left;
 }


<div class="center">
<div class="content">
This block is centered on the page
</div>
</div>

HWG hwg-style mailing list archives, maintained by Webmasters @ IWA