Bookmark and Share







The center element is deprecated.

Example

Center text in an HTML page:

<center>This text will be centered.</center>

Definition and Usage

The <center> tag is used to center text.

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The <center> tag is supported in all major browsers. However, it is deprecated and should be avoided!

Differences Between HTML and XHTML

NONE

Tips and Notes

Tip: Use CSS to center text! In our CSS tutorial you can find more details about centering text.


Standard Attributes

DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

The <center> tag supports the following standard attributes:

Attribute Value Description DTD
class classname Specifies a classname for an element TF
dir rtl
ltr
Specifies the text direction for the content in an element TF
id id Specifies a unique id for an element TF
lang language_code Specifies a language code for the content in an element TF
style style_definition Specifies an inline style for an element TF
title text Specifies extra information about an element TF


Event Attributes

The <center> tag supports the following event attributes:

Attribute Value Description DTD
onclick script Script to be run on a mouse click TF
ondblclick script Script to be run on a mouse double-click TF
onmousedown script Script to be run when mouse button is pressed TF
onmousemove script Script to be run when mouse pointer moves TF
onmouseout script Script to be run when mouse pointer moves out of an element TF
onmouseover script Script to be run when mouse pointer moves over an element TF
onmouseup script Script to be run when mouse button is released TF
onkeydown script Script to be run when a key is pressed TF
onkeypress script Script to be run when a key is pressed and released TF
onkeyup script Script to be run when a key is released TF
 

Our Followers

Speak to us !

Creative Commons License [Valid RSS] [Valid Atom 1.0] DMCA.com ScanVerify.com Trust Seal