CSS Text Effects allow you to control how text behaves when it overflows, wraps, breaks, or even changes its writing direction. These properties are essential for building clean, responsive UIs that handle long labels, dynamic content, and multi-language layouts.
…) or custom clipping when text overflows its container.overflow-wrap) – Allows long words to break and wrap onto the next line.
/* Basic syntax of common text-effect properties */
text-overflow: ellipsis;
word-wrap: break-word;
word-break: break-all;
writing-mode: vertical-rl;
This example shows how you might use all four properties in a small UI card.
/* Container that simulates a narrow UI card */
.card {
width: 260px;
border: 1px solid #e5e7eb;
padding: 10px;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
/* Truncate overflowing text with ellipsis */
.card-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Allow long words like URLs to wrap */
.card-body {
word-wrap: break-word;
}
/* Force breaks even inside long words if needed */
.card-warning {
word-break: break-all;
}
/* Vertical label on the side */
.vertical-label {
writing-mode: vertical-rl;
text-orientation: mixed;
}
The boxes below roughly mimic what you would see in a real layout.
overflow: hidden; and usually with white-space: nowrap; and a fixed width.text-overflow: ellipsis in UI labels or table cells for cleaner overflow control.word-wrap: break-word is great for responsive designs with dynamic content.word-break: break-all can help avoid layout breakage with unbreakable strings like URLs.writing-mode: vertical-rl for languages like Chinese, Japanese, or for decorative vertical headings.text-overflow: ellipsis to handle it.word-wrap: break-word.writing-mode: vertical-rl for side labels in a sidebar layout.word-break values like normal, break-all, and keep-all to improve readability in small-width elements.