I have a table (not <table>
but made of <div>
s) showing user-defined text. The text can be displayed in up to three text rows (inside a single table cell) and usually fits nicely. It can look like
Sed ut perspiciatis Nor again is there anyone who loves or
unde omnis iste X120 pursues or desires to obtain pain of
natus error itself, because it is pain
However, sometimes the text doesn't fit and then it must be shortened. I can clip it using overflow: hidden
, but I'd like to display ellipsis when this happens. However, text-overflow: ellipsis
doesn't work and according to css-tricks it's not expected to:
Note that
text-overflow
only occurs when the container'soverflow
property has the valuehidden
,scroll
orauto
andwhite-space: nowrap
.
I obviously can't use white-space: nowrap
as I don't want a single line text.
How can I show the ellipsis, when the text overflows, while otherwise keeping the behavior (wrapping in up to three lines and vertical and horizontal centering)?
This question is not a real duplicate as using display: -webkit-box
doesn't allow me to center the text both horizontally and vertically.