3 ms·
I would do it another way. I'd have an on state and off state graphic as a sprite. There'd be two divisions, one laid on top of each other. The bottom layer wou
by jwdunne 15y ago
I would do it another way. I'd have an on state and off state graphic as a sprite. There'd be two divisions, one laid on top of each other. The bottom layer would be the off state tiled horizontally statically at the width that is the number stars your ratings setup uses by the width of you on-off state graphic. The layer on top would be the on state with a width determined by an online style - CSS accepts percentage as a unit which can be worked out trivially. I find this is far more flexible that setting static widths in the CSS. You only haVe to set one width: the number of stars. Other things can be worked out programmatically and cached if needed.