In CSS, text spacing can be adjusted using a few different properties depending on the specific type of spacing you’re aiming to control.
1. Line Height: Controls the vertical spacing between lines of text.
p {
line-height: 1.5; /* or a unit value like 24px */
}
2. Letter Spacing: Adjusts the space between individual characters.
p {
letter-spacing: 3px; /* or other unit values */
}
3. Word Spacing: Modifies the space between words.
p {
word-spacing: 4px; /* or other unit values */
}
4. Text Indent: Indents the first line of text in a block.
p {
text-indent: 20px; /* or other unit values */
}
5. Text Align: Aligns text horizontally within its containing element.
p {
text-align: justify; /* or left, right, center */
}
6. Margin and Padding: Adds space around or inside elements, respectively, which can affect the overall spacing of text within its container.
p {
margin: 20px; /* space outside the element */
padding: 20px; /* space inside the element */
}