CSS Letter Spacing

Text indentation

text-indent This property is used to specify the indentation of the first line of the text:

Example

p {
  text-indent: 50px;
}

Try It Yourself

Letter spacing

letter-spacing This property is used to specify the spacing between characters in the text.

The following example demonstrates how to increase or decrease the spacing between characters:

Example

h1 {
  letter-spacing: 3px;
}
h2 {
  letter-spacing: -3px;
}

Try It Yourself

Line height

line-height The attribute is used to specify the space between lines:

Example

p.small {
  line-height: 0.8;
}
p.big {
  line-height: 1.8;
}

Try It Yourself

Word spacing

word-spacing The attribute is used to specify the space between words in text.

The following example demonstrates how to increase or decrease the space between words:

Example

h1 {
  word-spacing: 10px;
}
h2 {
  word-spacing: -5px;
}

Try It Yourself

Whitespace

white-space The attribute specifies how white space is handled within an element.

This example demonstrates how to disable text wrapping within an element:

Example

p {
  white-space: nowrap;
}

Try It Yourself