Truncate text after one line with an ellipsis

Sometimes you want to restrict the dimensions of a text block to perserve a consistent layout. The most commmon incarnation of this is a card component with the title on a single line. When the title is too long, it is truncated (cut short). An ellipsis can be added to the end to signify the truncation.
.truncate-one-line-ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} Another place that you see this utilised is page headers. On mobile screens space is limited and cannot accomodate a long title.

Demo
Explanation
We confine the text block to a single line through white-space: nowrap;. To truncate overflowing text, overflow: hidden; is used. If you use these two together, the text abruptly ends. There is no hint to the reader that there is additional content. That is where the text-overflow property comes in. It sets how hidden content is signaled to users. The ellipsis value appends an ellipsis to text that is truncated.