{"id":358210,"date":"2021-12-02T07:42:37","date_gmt":"2021-12-02T15:42:37","guid":{"rendered":"https:\/\/css-tricks.com\/?p=358210"},"modified":"2021-12-02T07:42:39","modified_gmt":"2021-12-02T15:42:39","slug":"fractional-svg-stars-with-css","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/fractional-svg-stars-with-css\/","title":{"rendered":"Fractional SVG stars with CSS"},"content":{"rendered":"\n

Some ⭐️⭐️⭐️⭐️⭐️ star rating systems aren’t always exactly even stars. Say you want to support rating something 2.25 stars. To do that you could “fill” the shape of the stars partially. I like this idea<\/a> by Samuel Kraft. The tricky part is:<\/p>\n\n\n\n

The final step is making the overlay div only affect the star SVGs beneath, not the background. We can do this by using the CSS mix-blend-mode<\/code> property with the color<\/code> value.<\/p><\/blockquote>\n\n\n\n

Check out Samuel’s post for an interactive demo and deeper information, but I thought I’d give it a crack myself to get a feel for the idea:<\/p>\n\n\n\n\n\n\n\n