The <center> element causes the enclosed contents to be center aligned within the margins of the current element. These margins are either the default page margins (for the body contents) or the margins of specific elements (like div, span or tables).
Syntax:
<center property=”value” property=”value” …. >
content to be centered
</center>
Valid Properties:
The <center> element has the following properties -
1. class
2. dir
3. id
4. lang
5. style
6. title
Refer to Common Properties page for details of these properties.
Example:
<center> This is a sample piece of text that is placed at the center of the page.</center>
Notes:
1. <center> element was defined by W3C as a shorthand notation for <div align=”center”>
2. Strict versions of the HTML and XHTML do not include the <center> element. The <center> element is deprecated and CSS is used to aligne the contents anywhere on the page.
3. HTML 3.2 does not support any properties for the <center> element.
Filed under: Block Level Elements Tagged: | Education, HTML / XHTML, Learn HTML, Learn XHTML, Training, Web Site Development