I’m finding it hard to visualise this with no HTML or image to look at, but here goes.
If you have a row (?) of five stars, and you want one, two, three or whatever of them to appear, then surely you need to increase the width of the display to reveal the correct number. 25px is only ever going to be wide enough to show one, isn’t it?
If you simply want to show 1 to 5 stars then just add one to 5 images to the html as required.
If you need it as a background image then you don’t need a sprite you just need the one star image and show it 5 times.
As technoBear said above if you have a sprite containing all 5 stars then you wil have to manipulate the width of the item as required to show more or less of the stars. e.g. if a star is 25px width then the element needs to be 50px wide to show two of them and so on…
Usually with stars you would show all 5 together but fade out the ones not chosen. It all depends on usage of course.
This example is about 10 years old but shows one way to achieve a more complicated system with a more complicated sprite.