This script will reduce the size of the div until it fits the required height, but with a minimum font-size of 10px hardcoded.
Now in the html, call the adjustHeight function, passing it the id of the div to adjust:
<body onload="adjustHeight(48)"> <div id="sign" style="font-size:68px">This is the text that fits</div> </body>
The trick here is that to read the fontSize of a div, the font-size property should be inline. If the font-size is declared in the CSS, you’ll have to use another much more complex method, described in http://developer.apple.com/internet/webcontent/styles.html.
PS: Instead of reading the font-size from the div, I could have hardcoded its value in the script, and avoided much trouble.