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.

Contributors

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

Learn CSS on Codecademy

Contributors