text-align

The text-align property describes how the content of an inline-level box aligns along the horizontal axis.

Syntax



text-align: start | end | left | right | center | justify | match-parent 


start - Specifies start alignment of the first line and any line immediately after a forced line break.

end - Specifies end alignment of the first line and any line immediately before a forced line break.

left - Aligning the text on the left edge.

right - Alignment of the text on the right edge.

center - Aligning the text to the center. The text is placed in the horizontal center of the browser window or container, where the text block is located.

justify - Alignment on width, which means simultaneous alignment on the left and right edges.

match-parent - Similar to inherit with the difference that the value start and end are calculated according the parents direction and are replaced by the adequate left or right value.


div {
text-align: left;
}

This is an introductory text that shows an example of using the property in practice.


div {
text-align: center;
}

This is an introductory text that shows an example of using the property in practice.


div {
text-align: right;
}

This is an introductory text that shows an example of using the property in practice.


div {
text-align: justify;
}

This is an introductory text that shows an example of using the property in practice.


div {
text-align: start;
}

This is an introductory text that shows an example of using the property in practice.


div {
text-align: end;
}

This is an introductory text that shows an example of using the property in practice.