text-align

The text-align property sets the horizontal alignment of inline content within a block.

Since CSS1 Spec ↗

Syntax

text-align: start | end | left | right | center | justify;

Examples

.title { text-align: center; }
.article { text-align: start; }
Output
Centers the title and left-aligns article text (right-aligned in RTL writing modes).

Notes

Prefer logical start/end over left/right for internationalization. Avoid justify for body text without hyphenation; it creates uneven rivers of whitespace. It does not align block-level boxes; use margin:auto or flexbox for that.

Browser & runtime support

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12

See also