I think this has been answered before, but i want to find the best solution to it since it will be run on something quite heavy performance wise.
Basically given this.
<div id="fit">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
and
#fit {
width: 400px;
font-size: 20px;
}
I want the font to be reduced until it fits.
A) Is there any way to do this via CSS?
B) I know i can do it in javascript, but this is going to load a handful of items (400-2000, it's a requirement), so if i implement it via javascript it must be quite fast.
C) Another idea would be to implement a pair of extra css classes and apply them according to the string length. Would that add a lot of extra overhead? Right now rendering it when there's no cache for that page can take up to 5 seconds (haven't optimized it yet, tho, the original dev is not working on this anymore)
Thanks