HTML <center> (Center Alignment) Tag

❮ Previous Reference Next ❯

Deprecated: HTML5 Not Supported.

Example

<center>
	<p>This is paragraph.</p>
</center>

Meaning

The <center> element causes the enclosed content to be centered within the margins currently in effect.

The <center> HTML element is a block-level element that displays its block-level or inline contents centered horizontally within its containing element.

The <center> element has been deprecated in HTML 4 (and XHTML 1) in favor of the CSS text-align property, which can be applied to the <div> element or to an individual <p>.

Or centering blocks, use other CSS properties like margin-left and margin-right and set them to auto (or set margin to 0 auto).

Version: HTML 3.2, 4, 4.01


Standard Syntax

<center>...</center>



Browser Support




Status







Use CSS for centering element, as shown in the following example:

Example

<div style="text-align:center">
  <p>First Paragraph.</p>
  <p>Second paragraph.</p>
</div>
❮ Previous Reference Next ❯