text-align

Sets the horizontal alignment of inline-level content inside a block container. It can align text to the left, right, center, or justify it.

It is documented as part of the CSS Text specification.

/* Usage Example */
.centered-text {
  text-align: center;
  /* aligns text to the middle of its container */
}

/* Syntax */
text-align: start;
text-align: end;
text-align: left;
text-align: right;
text-align: center;
text-align: justify;
text-align: match-parent;

/* Global values */
text-align: inherit;
text-align: initial;
text-align: revert;
text-align: revert-layer;
text-align: unset;
Widely available Since 2015 96% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

1+
1+
1+
12+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC