i want to resize the background image of a span based on the size of the selected font size of a user. how will i do this?

1 answer


not the way that you'd hope. The workaround is to absolutely position the text over the top of an inline image and size the image in ems. that way when the text grows, the image will grow too.

an example here: http://www.waycoolwebdesign.com/files/examples/image-resize/index.html

With a CSS background image all you can do (at the moment) is to center it and expose more of it as the container expands.

CSS3 has background-size but not all browsers support it yet.

Answered over 8 years ago by Tony Crockford