In an iPhone webapp I have a 50x50 square div that should contain number between 1 and 12. I want the number text to be scaled to fit the div. e.g The number twelve would likely need be scaled down because it's wider than the number 1.
The exact effect I'm looking for is the adjustSizeToFitWidth
property that native iPhone text labels use.
What's the most efficient way to go about this?
- CSS(3) - preferable because of rendering speed, but might not be possible.
- Javascript - I've used this before, but there would be a noticeable hitch between initial load and text resizing.
- Canvas - I know that scaling a canvas element will cause it's contents to be scalled, but can you draw text in a canvas that's sized to fit perfectly or can you only use exact font sizes?