KOMPX.COM or COMPMISCELLANEA.COM   

HTML centering

A text (or it may be other content) is HTML centered, horizontally and vertically, using just table and td tags, no CSS at all:

HTML centered

HTML code:


<table width="100%" height="100%">
	<tr>
		<td align="center">HTML centered</td>
	</tr>
</table>

HTML centering is the oldest method to center content horizontally and vertically. It works well not just in older web browsers, but also in ones that can be described as downright ancient, as deep as Internet Explorer 3 or Netscape 2.

HTML horizontal and vertical centering has become obsolescent as a result of semantic markup spread. But it is still reliable. There is a minor flaw in it though. It does not pass W3C validation because of height and width attributes used for table and align for td. But it is not a real problem for any practical case the method may be used today in. And it was not looked at as a real problem back in 1990s - early 2000s, when it was complicated or impossible to succeed in making a code both valid and working in the majority of browsers.

Browser support
Windows
Internet Explorer 3.0+
Firefox 1.0+
Google Chrome
Opera 3.5+
Safari 3.1+
SeaMonkey 1.0+
Mozilla 0.6+
Netscape 2.02+
Linux
Firefox 1.0+
Google Chrome / Chromium
Opera 5.0+
SeaMonkey 1.0+
Mozilla 0.6+
Netscape 2.02+
More