CSS text-align Property
The text-align property in CSS is used to specify the horizontal alignment of text in an element ie., it is used to set the alignment of the content horizontally, inside a block element or table-cell box.
Default Value : left if direction is ltr, and right if direction is rtl
- left: It is used to set the text-alignment into left. This is the default property.
- right: It is used to set the text-alignment to right.
- center: It is used to set the text-alignment into the center.
- justify: It is used to spreads the words into the complete line i.e., by stretching the content of an element.
- initial: It is used to set an element’s CSS property to its default value.
- inherit: It is used to inherit a property to an element from its parent element property value.
Please refer to the CSS Align article for further details.
Example: This example illustrates the use of the text-align property, in order to align it to specified values.
Supported Browsers: The browser supported by the text-align property are listed below:
- Google Chrome 1.0
- Internet Explorer 3.0
- Microsoft Edge 12.0
- Firefox 1.0
- Opera 3.5
- Safari 1.0