ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

7.1 CENTER Element

Netscape introduced the CENTER element to permit center alignment of block of text, figures, etc. They did this because there was a bug in several browsers so that markup like <P ALIGN="center"> lead to errors in display of the text. This problem has now been fixed, so that you should use ALIGN attributes to center align text inside other elements (P, BLOCKQUOTE, etc.) wherever possible, and should avoid using the CENTER element.

To properly center text, it is now recommended that you use DIV elements with the attribute ALIGN="center". This has the same effect as CENTER, but is compatible with future versions of HTML.

7.1.1 Particularly Useful Uses

CENTER does not introduce vertical spacing, so you can use this tag to center text between two closely spaced HRs. You can also use CENTER to center TABLEs -- in fact, this is currently the only way you can do so.

NOTE -- You can -- and should -- use DIV ALIGN="center" to do the same thing

7.1.2 Example of CENTER

  <CENTER>
     here is some centered text.....
     <P> HEre is another centered paragraph.
     <P> And yet another.
     <table border> <tr> <td> and here is a single-celled table! </td>
     </tr> </table>
  

which is displayed as:

here is some centered text.....

HEre is another centered paragraph.

And yet another.
and here is a single-celled table!


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998