Similar things have been asked around here. I myself had needed that once, and found no way of doing that accuarately with CSS only.
I ended up having a Javascript function that took each div and an inner paragraph with a predetermined font-size
and reduced its font size until the paragraph had less width and height than its parent div.