B.107. text-align

This property sets the horizontal alignment of text and other inline content within a block element.

If you're looking for a way to set the horizontal alignment of a block (e.g. to center it on the page), you should instead use the margin-left, margin-right, left, and right properties to achieve the desired effect (e.g. you can center a block horizontally by setting its left and right margins to auto).

Inherited: Yes

See also: Section B.108text-align-last, Section B.120vertical-align

B.107.1. Value

This property supports the following constant values:

  • center

  • justify

  • left

  • right

center, left, and right are self-explanatory. justify should be familiar to users of word processors; it causes the words on each line to be spaced out ...

Get HTML Utopia: Designing Without Tables Using CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.