How can I overlay a number between 0 and 99 in the middle of 'icon-star-empty'?
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
You css should look something like:
Your HTML might look like:
This can also be done using Font Awesome Layers using version 5.0
Simply do this from the Font Awesome docs on Stacked Icons:
Here is what I use for counter overlays (badges) with FontAwesome (FA) 5.1. Unlike using the new
fa-layers
method, this does not require SVG+JS. Simply add adata-count
attribute to<i>
markup...CSS
Markup
Example
Conclusion
Some FA icon sizes may require badge size/position tweaking, but works well for my purposes. All colors/positions can be adjusted for calendar overlays, text labels, or OP's star outline.
Note
Untested, but using the same CSS should work with older FA versions by changing
fas
class tofa
instead.