One line. text-overflow only decides how clipped inline content is drawn, so it needs content that overflows and a box that clips it:
.one-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
Drop nowrap and the text wraps instead of overflowing; drop overflow: hidden and it spills out visibly. text-overflow applies to block containers and isn't inherited, so set it on the box that clips, not on an inline child or a flex container.
Several lines. CSS Overflow 4 defines line-clamp: 3 as a shorthand for max-lines, block-ellipsis and continue, which fragments away everything after line 3 and puts an ellipsis at the end of the last line. No stable browser ships it yet, so production code uses the legacy form the spec keeps for compatibility:
.three-lines {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
-webkit-line-clamp only works with both of the other two -webkit- declarations. It sets the box's height to the clamped lines and draws the ellipsis; overflow: hidden is still needed to hide the lines after the clamp, which otherwise keep painting. The current draft turns such a box's display into flow-root, and Chrome 156 and Firefox 159 report that.
Wrapping, not truncating. overflow-wrap: anywhere (or break-word) breaks a long word or URL that would overflow. text-wrap: balance evens out line lengths in short blocks like headings; text-wrap: pretty asks for slower, better breaking, such as avoiding a lone last word.