View Full Version : Using sprites for toolbar images

23 Dec 2009, 9:21 AM
Has anyone used sprites for for toolbar icons? I have a series of images that I use as toolbar icons - save, find, etc (all the same size). I would like to use a sprite for this but am not sure how to do it. When you specify an icon attribute, ext generates the html for a background style attribute for that image.

If I pass in an icon attribute of "/img/save.gif", the resulting style attribute is :
style="background-image: url(/img/save.gif);"

I would like the resulting style to look something like this:
style="background: url(img/toolbar_sprite.gif) 0 -21px no-repeat;"

23 Dec 2009, 12:32 PM
use iconCls instead of icon.. You'll need to set a different iconCls for each button and reference the background-position in your css.