🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #44

Text Spacing


CSS Text Spacing

CSS has several properties to control text spacing.

In this chapter you will learn about the following properties:

  • text-indent
  • letter-spacing
  • line-height
  • word-spacing
  • white-space

CSS Text Indentation

The CSS text-indent property is used to specify the indentation of the first line in a text-block.

Tip: Negative values are allowed. The first line will be indented to the left if the value is negative.

Example

p {
  text-indent: 50px;
}

CSS Letter Spacing

The CSS letter-spacing property is used to specify the space between the characters in a text.

Tip: Negative values are allowed.

Example

h1 {
  letter-spacing: 5px;
}

h2 {
  letter-spacing: -2px;
}

CSS Line Height

The CSS line-height property is used to specify the space between lines.

Note: Negative values are not allowed.

Example

p.small {
  line-height: 0.8;
}

p.big {

line-height: 1.8;
}

CSS Word Spacing

The CSS word-spacing property is used to specify the space between the words in a text.

Tip: Negative values are allowed.

Example

  p.one {
  word-spacing: 10px;
}

p.two {
  word-spacing: -2px;
}

CSS White Space

The CSS white-space property specifies how white-space inside an element is handled.

This property can have one of the following values:

  • normal
  • nowrap
  • pre
  • pre-line
  • pre-wrap

Example

  p {
  white-space: nowrap;
}

The CSS Text Spacing Properties

Property Description
letter-spacing Specifies the space between characters in a text
line-height Specifies the line height
text-indent Specifies the indentation of the first line in a text-block
white-space Specifies how to handle white-space inside an element
word-spacing Specifies the space between words in a text

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Text Spacing – FAQs

Quick answers about learning Text Spacing in CSS.

This free note from CodingNow 2.0 explains Text Spacing in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including Text Spacing, is 100% free with no signup required.
With focused practice, most students grasp Text Spacing in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now