Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Vertical Center with CSS


encyclo - 7:08 pm on May 29, 2007 (gmt 0)


OK, I'll throw a spanner in the works. ;) For the sake of completeness, I think we'll have to include this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Vertical center</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
<tr>
<td width="100%" align="center">This text is centered vertically and horizontally.</td>
</tr>
</table>
</body>
</html>

Quirks mode only, eeevil table, invalid height attribute on the table element, but hey it works in IE2+, NN2+, and everything else, and it is much more concise than any of the methods above.

/me puts on flame-retardant suit, ready for incoming ;)


Thread source:: http://www.webmasterworld.com/css/3350566.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com