CSS provides extensive control over the spacing, alignment, decoration, transformation, and wrapping behavior of typographic content. Proper text formatting guarantees pristine legibility across diverse languages, device viewports, and high-density screens.
| Property | Standard Values | Visual Styling Effect |
|---|---|---|
text-align |
left, center, right, justify |
Controls the horizontal alignment of inline text within its block container. |
text-transform |
uppercase, lowercase, capitalize |
Changes letter casing dynamically without modifying the source HTML text. |
text-decoration |
underline, line-through, none |
Adds or removes underlines. Modern CSS supports color and style: underline wavy #d22b2b. |
letter-spacing |
1px, 0.05em |
Adjusts the horizontal kerning tracking space between characters. |
text-shadow |
2px 2px 4px rgba(...) |
Applies depth drop shadows behind text glyphs. |
When text is too long to fit inside a card header or table cell, you can truncate it gracefully with three dots (...):
.truncate-text {
width: 250px;
white-space: nowrap; /* Prevent text from wrapping to line 2 */
overflow: hidden; /* Hide the excess text */
text-overflow: ellipsis; /* Append '...' to truncated text */
}
Long URLs or continuous character strings can break responsive layouts by pushing past container boundaries. Solve this with overflow-wrap:
/* Prevents long URLs from overflowing cards on mobile devices */
p, .card-content {
overflow-wrap: break-word;
hyphens: auto; /* Enables dictionary hyphenation */
}
.neon-glow {
color: #ffffff;
font-weight: 800;
text-shadow:
0 0 5px #d22b2b,
0 0 10px #d22b2b,
0 0 20px #ef4444;
}
Boost your CSS and front-end development proficiency by exploring these closely connected topics:
Understand margins, borders, padding, content and the universal box-sizing fix.
Master 1D alignment, justify-content, align-items, flex-wrap and responsive flow.
Build powerful two-dimensional grid layouts with template areas and fr units.
Eliminate styling conflicts and master selector weights from 0,0,0,1 to !important.