CSS text align

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.valueDescription
1startUsed to align the text to the start edge of the block. The value for this is start.
2endUsed to align the text to the end edge of the block. The value for this is end.
3leftUsed to align the text to the left edge of the block. The value for this is left.
4rightUsed to align the text to the right edge of the block. The value for this is right.
5centerUsed to align the text to the center edge of the block. The value for this is center.
6justifyUsed to align the text to the justify edge of the block. The value for this is justify.
7initialUsed to define as the property initial value.
8inheritUsed to define the computed value of property on the elements parent.
9unsetUsed 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.