Basic CSS only percentage based star rating System.
Demo: https://jsfiddle.net/NullDev/nju10Loz/2/
License: https://gist.github.com/NullDev/f65b57677505e72986536652aa5dbc9c
| .rating { | |
| unicode-bidi: bidi-override; | |
| color: #c5c5c5; | |
| font-size: 25px; | |
| height: 25px; | |
| width: 100px; | |
| margin: 0 auto; | |
| position: relative; | |
| padding: 0; | |
| text-shadow: 0px 1px 0 #a2a2a2; | |
| } | |
| .rating-upper { | |
| color: #e7711b; | |
| padding: 0; | |
| position: absolute; | |
| z-index: 1; | |
| display: flex; | |
| top: 0; | |
| left: 0; | |
| overflow: hidden; | |
| } | |
| .rating-lower { | |
| padding: 0; | |
| display: flex; | |
| z-index: 0; | |
| } |
| <div class="rating"> | |
| <div class="rating-upper" style="width: 0%"> | |
| <span>★</span> | |
| <span>★</span> | |
| <span>★</span> | |
| <span>★</span> | |
| <span>★</span> | |
| </div> | |
| <div class="rating-lower"> | |
| <span>★</span> | |
| <span>★</span> | |
| <span>★</span> | |
| <span>★</span> | |
| <span>★</span> | |
| </div> | |
| </div> |
Basic CSS only percentage based star rating System.
Demo: https://jsfiddle.net/NullDev/nju10Loz/2/
License: https://gist.github.com/NullDev/f65b57677505e72986536652aa5dbc9c
Thank you! By the way, the link to the license doesn't work. @NullDevCo
Ah right, thanks for pointing that out @obliviga !
I corrected the link :)
This is super clean. Works well. Implemented in a React component. Thanks. :)