text-align

To set the text alignment of inline contents.

Syntax

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.

Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback form.

Learn CSS on Codecademy

Edit this page on GitHub

Contributors