~uglyduck/uglyduck.srht.site

ref: 494dcd504bd6ebb68b59e8a04057b0a087570d38 uglyduck.srht.site/_posts/2016-11-15-the-wonders-of-text-ellipsis.md -rw-r--r-- 1.7 KiB
494dcd50 — Bradley Taunt tweaking overall design - still very much a WIP 8 months ago

A common issue when working with constrained UI elements is text overflowing outside of it's parent or breaking into addition lines (thus breaking the layout).

This is most commonly seen with the direct and placeholder values for input fields on form elements. For example, the following input placeholder will be cutoff from the user's view:

See the Pen Text Ellipsis (Input Placeholders) by Bradley Taunt (@bradleytaunt) on CodePen.

Luckily, 3 simple CSS parameters can fix this.

input::placeholder {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

This allows the user to understand there is more content cut out from their current view. It's not ideal to ever have content overflowing outside of the parent container, but if you need to the best workaround is to use text-overflow.