like below fixes the issue Calc is still in it's infancy in terms of support & usefulness. By design it's really just there for doing simple math, like (100% - 20px). It really won't do the math complex enough to make the calculations possible. You are looking for a solution that will size the text based on the amount of space the letters physically take up horizontally (which depends on the letter's individual sizing) and the amount of space available for the containing div. CSS is abstracted away from the actual element's contents, and it has no way to really discern if something currently "fits" or not. It can layout guidelines for how to handle things when they do or don't fit, but it can't adjust itself according to the content like you want it to. (It's not just you, we've all faced this problem or a similar version of it at some point.)
constant distance to baseline while dynamically changing font-size - html - text element
help you fix your problem The problem here is your line-height in combination with the font you use. As you notice you set the bottom to 0, yet the text is not aligned with the bottom of the window, as you would expect. This can be solved by setting the line height to a value without a unit. This way the line height will be relative to the font size. One would expect that setting the line height to one would solve this, but this depends on the font, and how much of it's available height it uses.
line-height: .7; /* this will depend on the used font */
Is changing div's height after browser resize to size dependent on text's length and font's size an good idea?
seems to work fine As per what Rory suggestion, I would recommend media queries with below-suggested breakpoints Min-width: 320px (smaller phone viewpoints) Min-width: 480px (small devices and most phones) Min-width: 768px (most tablets) Min-width: 992px (smaller desktop viewpoints) Min-width: 1200px (large devices and wide screens)
Calculate ideal font size, based on the paper size and maximum allowed text length