CSS Text properties allow you to control how text appears on a webpage. These properties help improve readability, spacing, alignment, decoration, and overall design. Text styling is an essential part of web design because it affects user experience and visual structure.
The color property is used to set the text color. You can use color names, HEX, RGB, or HSL values.
p {
color: #333;
}
The text-align property aligns text inside an element.
h1 {
text-align: center;
}
Used to add lines to text.
a {
text-decoration: none;
}
Changes the case of text.
h2 {
text-transform: uppercase;
}
Controls the space between characters.
p {
letter-spacing: 1px;
}
Controls the space between words.
p {
word-spacing: 5px;
}
Controls spacing between lines.
p {
line-height: 1.6;
}
Adds shadow effects to text.
h1 {
text-shadow: 2px 2px 5px gray;
}
Indent the first line of a paragraph.
p {
text-indent: 30px;
}
CSS supports text direction and vertical text.
p {
direction: rtl;
}
Vertical text example:
p {
writing-mode: vertical-rl;
}
Controls how text wraps or collapses. Common values:
div {
white-space: nowrap;
}
CSS Text properties help improve:
They are a core part of modern web design.