L
L
lxfr2017-03-27 14:16:23
User interface
lxfr, 2017-03-27 14:16:23

How to make text automatically expand/shrink in a layer (div)?

Suppose I have a DIV on my site, a regular layer.
For example 300 by 200 pixels.
And in this layer I display different text.
Sometimes big, sometimes not so much, generally from 5 words to a small paragraph of 25-30 words.
How (preferably via CSS) can I make the text automatically resize to the size of the DIV and be displayed occupying the entire layer, but the DIV itself should not change in size?
Those. if there is only one word, it is large and is displayed in a large font; if it is a sentence, the text size is already smaller, and everything fits into the layer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay, 2017-03-27
@lxfr

Use relative units for text: rem, em, %

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question