Shrinking font-size at a user types to fit in an input using Javascript
问题 Apple's MobileMe uses javascript to change the font size in the email login on its homepage as the user types so that the text always fits in the available space without overflow scrolling. While I can see how how to execute a function on each keypress, I'm curious how one would go about caluclating the font-size each time so that it always fits into the input field. Is there a way to measure the length of a piece of text with a variable width font? How do they accomplish this effect? Try it