Kompx.com or Compmiscellanea.com

HTML centering

Windows : Internet Explorer 3.0+, Firefox 1.0+, Google Chrome, Opera 3.51 - 6.xx and 9.0+, Safari 3.1+, SeaMonkey 1.0+ [ 1 ].

Linux : Firefox 1.0+, Chromium, Opera 5.0 - 6.xx and 9.0+, SeaMonkey 1.0+ [ 2 ].

Centering the whole content of a web page in the viewable area of a browser by pure HTML - no CSS. A box to keep the content of the page is HTML centered horizontally and vertically - [ Open demo page ]

HTML. Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>HTML centering</title>

<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">

</head>

<body bgcolor="#ffffff">

<table width="100%" height="100%" bgcolor="#a3ddc4">

<tr>

<td align="center">

<table width="800" height="500" bgcolor="#ff6f6f">

<tr>

<td>&nbsp;</td>

</tr>

</table>

</td>

</tr>

</table>

</body>

</html>

The outer HTML table makes the whole web browser viewable area, except margins, a HTML table and the whole area of this HTML table - a HTML table cell.

The cell of the outer HTML table inherits the default value for valign attribute from its parent table row. And this row in its turn inherits the default value for valign attribute from the outer HTML table tbody - even if tbody tag is not used. And that value is middle. So a block of content inside the cell of the outer HTML table is centered vertically in web browser viewable are.

Align="center" of the outer HTML table cell makes a block of content inside it centered horizontally in web browser viewable are.

The inner table, the one inside of the outer HTML table cell makes up a box of a given size. Or there may be no set height or no set width or both. Then the size of the box is to adjust to accommodate the content, whatever its dimensions are. If the width or height or both of the box results to be larger than web browser viewable area, then it still ends up to be centered.

Since HTML centering is the oldest method to center content horizontally and vertically, it works well not just in older web browsers, but in ones that can be described as downright ancient. Like adding one more HTML tag ( <center></center> ) around the outer table makes it funcion as deep as Internet Explorer 3 : [ Open demo page ]

Download Internet Explorer 3: a pack, containing 3.0, 4.01, 5.01, 5.5, 6.0 versions of Internet Explorer

HTML. Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>HTML centering for Internet Explorer 3</title>

<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">

</head>

<body bgcolor="#ffffff">

<!-- For Internet Explorer 3 --><center><!-- For Internet Explorer 3 -->

<table width="100%" height="100%" bgcolor="#a3ddc4">

<tr>

<td align="center">

<table width="800" height="500" bgcolor="#ff6f6f">

<tr>

<td>&nbsp;</td>

</tr>

</table>

</td>

</tr>

</table>

<!-- For Internet Explorer 3 --><center><!-- For Internet Explorer 3 -->

</body>

</html>

HTML horizontal and vertical centering of a box containing web page content has become obsolescent as a result of semantic markup spread. But it is still reliable. Not only in the major and modern web browsers, but in many alternative and older ones as well.

There is a minor flaw in it though. The height attribute of the <table><table/> tag is used there. It is supported for years by the majority of web browsers, but is incompatible with the standards promoted by World Wide Web Consortium (W3C). So the code does not pass W3C validation. Back in 1990s - early 2000s, it was complicated or impossible to succeed in making a code both valid and working in the majority of web browsers, so the flaw was not looked at as a real problem.


[ 1 ]

As well as Netscape 2.02 - 4.80 and Offbyone. There is some shift of page content to the top left corner of the web browser viewable area in Netscape 2.02 - 4.80, since these web browsers reserve the place for scrollbars.

[ 2 ]

As well as Netscape 2.02 - 4.80. There is some shift of page content to the top left corner of the web browser viewable area in Netscape 2.02 - 4.80, since these web browsers reserve the place for scrollbars.


Aliosque subditos et thema

 

CSS centering <hr />

 

CSS centering <hr />, if its width is less than 100%. Horizontal centering. Example: HTML / XHTML. Code: <hr /> CSS. Code: hr {width: 50%; margin: 0 25% 0 25%;} /* Extra CSS, just styling the look: */ hr {height: 1px; float: left; border: 0px; color: #f00; background: #f00;} Note: mostly it works both with float: left and float: none. But float: left makes it for sure. [ 1 ] As well as Netscape 4.04+, Mozilla 0.6+. [ 2 ] As well as Netscape 4.04+, Mozilla 0.6+.

Internet Explorer 3

 

Features : Screenshots : Download links World Wide Web service with its online experience like hypertext links, surfing, web pages as a combination of text and images / multimedia brought Internet to general public. As to general public, it all very much revolves around the web browser. The first web browser ever, WorldWideWeb (later renamed Nexus) had many of the features later to be considered as standard for web browsers, but it was an experiment, accessible and known to very few. The rest of users might expect more likely only a text-mode interface experience through a text-based web browsers like Line Mode Browser. The turning point for the World Wide Web and all Internet was the advent of Mosaic, a graphical web browser, in 1993. First for Unix and then for Apple Macintosh and Microsoft Windows. Mosaic was not the first web browser for Windows though and it could not supersede Cello, the first and initially the only web browser for Windows. Microsoft Windows was the fastest growing major platform for PC in the first half of 1990s. But Microsoft did not seem to recognize the importance of the web browser then. So the main competition under Windows at that time was among several versions of Mosaic and Cello. This competition gave birth to Netscape web browser, which became the dominant software of its kind for several years. This success and great public attention attracted by World Wide Web by 1995 made Microsoft to join in the efforts. Internet Explorer 1 was just a first experiment. Internet Explorer 2 was intended to push the Internet Explorer case - it was made available to all Windows users for free, even commercial companies. But Netscape positions were not much undermined, Internet Explorer 2 being distinctly weaker in many features is among the reasons for that. Only after the release of Internet Explorer 3.0 Microsoft browsers began to close Netscape in qualities. Internet Explorer 3 was not the first Microsoft attempt to find technical and marketing model like were Internet Explorers of 1 and 2. And it was not the first Microsoft modern web browser, the first for Microsoft to beat and surpass Netscape and all other web browser competitors like Internet Explorer 4 was. But Internet Explorer 3 still was the first in some things: the first commercial browser with Cascading Style Sheets / CSS support, the first Microsoft web browser without Spyglass source code and the first Microsoft web browser to gain a significant user share, 20-39% by the end of 1997 [ 1 ]. Still, Internet Explorer 3 was a transitional, intermediate piece of software between the early browsers and the modern ones. As to its modern state, there is an interesting detail: Internet Explorer 3 can run under 32-bit Windows 7, unlike generally the 4.0-6.0 Explorers. Features HTML (with tables and frames) support is quite strong ( More ), Internet Explorer 3 lets some HTML tricks to be used without extra strain, like "HTML table borders without CSS". CSS support in Internet Explorer 3 is weak ( More 1 ) ( More 2 ). Internet Explorer 3 also supports VBScript, ActiveX (more than 1,000 Controls), Java applets, inline multimedia, VRML and a Microsoft's reverse-engineered version of JavaScript named JScript. All of the versions and capabilities corresponding to the level of the times. Internet Explorer 3 was released for several platforms: x86(16/32 bit), 68k, PPC, MIPS, Alpha AXP. And several operating systems: Windows 3.1, Windows 95, Windows NT, System 7 / Mac OS 7, Mac OS 8.