CSS text-align property

CSS text-align

CSS text-align is used to specify the texts horizontal position in an element.

Following are the values used in CSS text-align property,

  • left
  • right
  • center
  • justify

left value for css text-align property

It aligns the text to the left side.

In here the text in the left side will start at the same horizontal position, and may be the text in the right side will be in non uniform order.

Example

Try Yourself

right value for css text-align property

It aligns the text to the right side.

In here the text in the right side will end at the same horizontal position, and may be the text in the left side will be in non uniform order.

Example

Try Yourself

center value for css text-align property

It centers the text.

In here the left and right side text will be in non uniform order.

Example

Try Yourself

justify value for css text-align property

It aligns the text, by stretching the lines so each line has equal width.

In here the text in the left and right side will start and end at the same horizontal position.

Example

Try Yourself