Published Jun 30, 2021Updated Sep 3, 2021
Contribute to Docs

To set the text alignment of inline contents.


text-align: <text-align-value>;

The text-align-value can be the following:

  • left
  • center
  • right

Example 1

Set the p tag to center:

p {
text-align: center;

The text in p tag will be centered.

All contributors

Looking to contribute?

Learn CSS on Codecademy