Javascript resize text as an image
I was wondering how to resize a div containing some text by setting a width and height so it would stretch to fill that area like an tag? E.g. when you set the width and height attribute of an image, it resizes the image to fill that area. I need to take an arbitrary width and height value and stretch a div containing text to those di开发者_StackOverflow社区mensions. I do not wish to send a request to a php script to build an image containing the text since it will be slow and affect the scalability of the web app. Oh, and I would preferably not like to use html5 because it is a requisite that I need compatibility with ie7+ (and firefox/chrome).
Thanks.
Ok, Here is how to do that.
http://www.jsfiddle.net/Zp8AH/
However, some factors like Font Family, Division width have to be fixed, in order for this code to work.
精彩评论