Re: CSS Help

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

 Date:  Sat, 15 Mar 2003 11:51:58 -0500
 To:  "Ken Cole" <ken.cole(at)smiths-aerospace.com.au>,
<hwg-basics(at)mail.hwg.org>
 References:  com
  todo: View Thread, Original
Hello Ken,

> I have a DIV with a defined height, color, etc.
> In that DIV I have an anchor tag with a class.  I have tried several
things
> to center the anchor text vertically in the DIV but none seem to work.

Unfortunately, CSS does not yet provide a way to vertically center elements
within a block. The only possibility is to vertically align content of
inline boxes in respect to the inline box's parent element. An exampe would
be to align text alongside an image.

img {vertical-align: middle}

<p>One line of this text will be aligned to the center of this image. <img
... ></p>

http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align


> What should work for this?

Unfortunately, the only way to vertically align elements within a box is to
use a table.


Tim

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA