Jump to content

Vertical center of a page


midnite

Recommended Posts

i am sure that my content is not longer than the height of the browser, because it consists of just a few words in a line.And i want my content to be placed in the vertical center of the page.If i skip <DOCTYPE>, i can use <table height="100%"> and <td valign="middle">. But it is not standard.i want to use XHTML 1.1 to achieve this: setting the content in vertical center.Is there a way? Thanks!!ReferenceStandard <DOCTYPE>: http://www.w3.org/QA/2002/04/valid-dtd-list.htmlValidator: http://validator.w3.org/

Link to comment
Share on other sites

Yeah, there's a XHTML 1.1 valid way.

<table style="height:100%;">  <tr>	<td style="vertical-align:middle;"><p> </p></td>  </tr></table>

It's been so long since I have used percentages on heights in CSS, but if I recall correctly, they don't work that well.http://www.w3schools.com/css/pr_dim_height.asphttp://www.w3schools.com/css/pr_pos_vertical-align.asp

Link to comment
Share on other sites

Be sure that you serve XHTML 1.1 with application/xhtml+xml. Otherwise just use XHTML 1.0 Strict.
you mean the line <?xml version="1.0" encoding="utf-8"?> ? i have include this at the top of the file.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...