CSS text align is used to define the alignment of HTML elements. This property aligns the text to the left, right, center etc.

The syntax for CSS text-align is:

For example

lets take the example of HTML paragraph tag contains some text. CSS text align property align it to the right side.

Output

This is the HTML paragraph inside the div to show center alignment of text. This uses text align property to align the content.

CSS text align values list

The values and description of this property is used for defining alignment of text.

Sr. No. value Description
1 start Used to align the text to the start edge of the block. The value for this is start.
2 end Used to align the text to the end edge of the block. The value for this is end.
3 left Used to align the text to the left edge of the block. The value for this is left.
4 right Used to align the text to the right edge of the block. The value for this is right.
5 center Used to align the text to the center edge of the block. The value for this is center.
6 justify Used to align the text to the justify edge of the block. The value for this is justify.
7 initial Used to define as the property initial value.
8 inherit Used to define the computed value of property on the elements parent.
9 unset Used to define the property either acts as inherit or initial, depending on the property if it is inherited or not.

CSS text align center

This text align center will align the paragraph content to the center of block.

Output

This is the HTML paragraph inside the div to show center alignment of text. This uses text align property to align the content.