September 8th, 2003, 10:39 AM
centering text with css horizontally and vertically
I've seen quite a few articles on CSS Layout Techniques and how tables are bad etc... so I thought I would give CSS another chance as far as page layout goes.
I'm simply trying to center some text on a page both horizontally and vertically. Using tables I would use the following code:
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<td align="center" valign="middle">center this text</td>
With css ??? (this centers horizontally)
font-family: Verdana, Arial, Helvetica, sans-serif;
<div class="center">this is centered</div>
I'm sure there has to be a simple solution but???
I found these links might be of interest
September 21st, 2003, 11:14 PM
frankly, you might want to stick with your old reliable tables, which you may find will have more support cross-browser.
afaik there is no sure-fire, reliable way to do this with css. if anyone knows of a way, please speak up.
i think that the way that is officially recognized by the css2 spec is
but...well, just try it across various browsers...