CSS text-align Property


In CSS, the text-align property is used to specify the horizontal alignment of text in an element, i.e., it is used to set the horizontal alignment of content inside a block element or table-cell box.

Syntax

Example

Preview

Property Values

Value Description
left The text is aligned to the left.
right The text is aligned to the right.
center The text is centred.
justify Stretches the lines so that they are all the same width (like in newspapers and magazines).
initial This property is set to its default value.
inherit This property is inherited from its parent element.

Supported Browsers

Property Chrome Firefox Safari Edge / IE Opera
text-align 1.0 1.0 1.0 3.0 3.5