CSS text-align property
Browser support · legacy reference
ChromeFully supports
SafariFully supports
FirefoxFully supports
Internet ExplorerFully supports
EdgeFully supports
OperaFully supports
Description
CSS text-align property represents how to align the inline-level content along the inline axis if does not fit within a line box.
It does not affect the last line of text in a box.
Syntax
text-align : start | end | left | right | center | justify | match-parent
Property values
justify
-
It justifies the content according to the method specified by the text-justify i.e. it exactly fills the line axis except the last line which is aligned at start.
- Try it
text-align: justify; match-parent
-
In this case, the current element inherits the value of text-align from the parent element.
If the value of text-align property for the parent element is center, the value of text-align property for the current element will also be center. -webkit- prefix resolves the browser compatibility issues.
- Try it
text-align: -webkit-match-parent;
Applicable to
It applies to all elements