Can I resize text to fit div size?

It seems to me that this is a fairly natural use case, although I could not find anything on it:

Let's say I have a fixed-width div that is dynamically populated with some number. What is the best way to ensure that numbers with a large number of numbers occupy smaller font sizes so that they fit well into this fixed width? Is there any CSS property for this, or do I need to resort to Javascript hacking?

+5
source share
2 answers

There is no CSS property that automatically adjusts the font size based on a fixed container. You have to resort to javascript.

, . , . , .

, , div , (, "position: absolute; left: -5000px;" )

+3

All Articles