Text Spacing
CSS provides different properties to control the spacing between letters, words, and lines of text.
The commonly used text spacing properties are letter-spacing, word-spacing, line-height, and text-indent.
How Text Spacing Works
Example 1: Letter Spacing
The letter-spacing property controls the space between individual letters.
CSS Code
h2 {
letter-spacing: 4px;
}
Output
CIIT TRAINING
Example 2: Word Spacing
The word-spacing property controls the space between words.
CSS Code
p {
word-spacing: 12px;
}
Output
Welcome to CIIT Training Institute
Example 3: Line Height
The line-height property controls the vertical space between lines of text.
CSS Code
p {
line-height: 2;
}
Output
CIIT Training Institute provides practical training for students and professionals. Learn programming and development skills step by step.
Example 4: Text Indent
The text-indent property adds space before the first line of text.
CSS Code
p {
text-indent: 40px;
}
Output
CIIT Training Institute provides practical and structured training designed to build real-world technical skills.
Common Text Spacing Properties
| Property | Purpose |
|---|---|
letter-spacing
|
Controls space between letters |
word-spacing
|
Controls space between words |
line-height
|
Controls vertical space between lines |
text-indent
|
Adds indentation to the first line |
Simple Explanation
letter-spacing → Controls the space between letters.
word-spacing → Controls the space between words.
line-height → Controls the space between lines.
text-indent → Adds space before the first line.
Summary
CSS text spacing properties control the space
between letters, words, and lines of text.
Common properties include
letter-spacing,
word-spacing,
line-height, and
text-indent.