CSS GUIDE TEXT ALIGN
This document is a work in progress and is subject to change.
Contents
Summary
The text-align property is used to to describe how contents of a block are horizontally aligned.
Applicability: | The text-align property can be used for all CSS elements. | |
Media Group: | Visual | |
Inherited: | Yes |
Syntax
TARGET_ELEMENT { text-align: start | end | left | right | center | justify | <string> }
Legal Values
There are 7 possible values for text-align:
Value | Explanation |
---|---|
start | Contents are aligned to the start edge of the line box. |
end | Contents are aligned to the end edge of the line box. |
left | Contents are aligned to the left edge of the line box. |
right | Contents are aligned to the right edge of the line box. |
center | Contents are centered within the line box. |
justify | Text is justified according to the method specified by the 'text-justify' property. |
<string> | When applied to a table cell, specifies a string on which all cells in its table column that also have a string value for 'text-align' will align. |
See usage examples section for more details.
Mozilla Recommended Values
Usage Examples
center { text-align: center } Creates center element that will align contents in center of line box
Notes
The World Wide Web Consortium (W3C) provides a free online CSS validation service.