The text-align property in CSS is used for aligning the inner content of a block element.

CSS Syntax

text-align: left | right | center | justify | initial | inherit;

Let's see an example:

<!DOCTYPE html>
       <title>Title of the document</title>
       <div> Example for the text-align property. </div>
       <p>Some paragraph for example.</p>


Property Values

Value Descriptions
left The default value. It aligns the text to the left.
right It aligns the text to the right.
center It aligns the text to the center.
justify Extends the lines so that each line has equal width.
initial It makes the property use its default value.
inherit It inherits the property from its parents element.

Related articles