Smal SEO Tool

CSS Text

CSS provides a wide range of properties for formatting text, controlling everything from alignment and decoration to spacing and transformation.

Text Alignment

The text-align property is used to set the horizontal alignment of text. It can be set to left, right, center, or justify.

Example

css
p {
  text-align: center;
}
Try it Yourself »

Text Decoration

The text-decoration property is used to add or remove decorations from text, such as underlines. Common values are none, underline, overline, and line-through.

Example

css
a {
  text-decoration: none;
}
h2 {
  text-decoration: underline;
}
Try it Yourself »

Text Transformation

The text-transform property controls the capitalization of text. Values include uppercase, lowercase, and capitalize (which capitalizes the first letter of each word).

Example

css
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
Try it Yourself »

Text Spacing

CSS offers several properties to control the spacing within your text:

  • letter-spacing: Adjusts the space between characters.
  • word-spacing: Adjusts the space between words.
  • line-height: Sets the distance between lines of text.
  • text-indent: Indents the first line of text in a block element.

Example

css
p {
  letter-spacing: 2px;
  line-height: 1.6;
}
Try it Yourself »

Test Yourself with an Exercise

Which property is used to control the horizontal alignment of text?