Ok, let's say I have a 50px div that is used to display text gathered from a db, a file, or whatever. However, if the text happens to be too big to fit in the div, I want it truncated, and I want to fit as much text as possible inside the div, but also append a (...) in the end (the div's overflow is already set to hidden).
Example words and expected results:
OOOOOOOOOOOOOOO OOOOOOO
iiiiiiiiiiiiiii iiiiiiiiiiiiiii iiiiiiiiiiiii
Expected results would be:
OOOOOOO(...)
iiiiiiiiiiiiiii iiiiiiiiiiiii(. ..)
(As you can see, 28 i's take about the same amount of space as 7 O's, and changing the font is not an option.).
I don't think I'm the first person to face this issue so I was wondering if there was a known way to do this sort of thing I'm not aware of.
Example words and expected results:
OOOOOOOOOOOOOOO OOOOOOO
iiiiiiiiiiiiiii iiiiiiiiiiiiiii iiiiiiiiiiiii
Expected results would be:
OOOOOOO(...)
iiiiiiiiiiiiiii iiiiiiiiiiiii(. ..)
(As you can see, 28 i's take about the same amount of space as 7 O's, and changing the font is not an option.).
I don't think I'm the first person to face this issue so I was wondering if there was a known way to do this sort of thing I'm not aware of.
Comment