I have a grid that filled screen and each it's cell contain some text as labels. What should I write in CSS to resize this text to fill container without overflow? Keep in mind it may be restricted by height or by width.
Now it is just
label {
display: flex;
justify-content: center;
align-items: center;
font-size: 150pt; /*must be adaptive*/
}
Jsfiddles: grid 3x3, grid 1x10
Or if there is no ideas...
At the moment I have two formulas as alternate variant that can calculate desired font-size relative to height (first) and width (second). I would use min()
of them if it was supported. So if there is no elegant solution on CSS, the other question: will it be effectively to define CSS variable and set to it min of formulas with js in window.onresize
?