Valid XHTML Vertical Centering Using CSS

The simplest method to vertically center your elements while using XHTML is to use the table property of the div tag. With this method you can style your div to act like a table with a cell under it.

Vertically centered text

As you can see above, the code has made the text become vertically centered. The text is not horizontally centered but that’s just as easy with the well known margin:0 auto; horizontal center method, or even text-align:center;.

Related posts:

  1. Embedding Flash Files With Valid XHTML (Strict) I’m sure a lot of people want to know the...
  2. XHTML Strict & target=”_blank” (and _top) I had made a post a few days ago regarding...
  3. Rotating Script for Text Ads, Banner Ads or Interstitials (or Anything Else!) The following are simple instructions to create a script to...

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>