Skip to content

Instantly share code, notes, and snippets.

@risuvoo
Created April 19, 2025 05:17
Show Gist options
  • Select an option

  • Save risuvoo/c5606902049d04ebcb318f8b910a0874 to your computer and use it in GitHub Desktop.

Select an option

Save risuvoo/c5606902049d04ebcb318f8b910a0874 to your computer and use it in GitHub Desktop.
Review Star Percentage tailwindcss
<div class="w-full">
<svg class="hidden">
<symbol
id="star"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 23 23"
stroke-width="1.5"
class="size-5"
stroke="currentColor"
fill="none"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"
/>
</symbol>
<symbol
id="star-filled"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 23 23"
class="size-5"
>
<path
fill="currentColor"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
d="M11.48 3.499a.562.562 0 0 1 1.04 0l2.125 5.111a.563.563 0 0 0 .475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 0 0-.182.557l1.285 5.385a.562.562 0 0 1-.84.61l-4.725-2.885a.562.562 0 0 0-.586 0L6.982 20.54a.562.562 0 0 1-.84-.61l1.285-5.386a.562.562 0 0 0-.182-.557l-4.204-3.602a.562.562 0 0 1 .321-.988l5.518-.442a.563.563 0 0 0 .475-.345L11.48 3.5Z"
/>
</symbol>
</svg>
<div class="relative inline-block">
<!-- none fillable star -->
<div class="text-[#FFC403] inline-flex space-x-1">
<svg viewBox="0 0 23 23" class="w-5 h-5">
<use xlink:href="#star"></use>
</svg>
<svg viewBox="0 0 23 23" class="w-5 h-5">
<use xlink:href="#star"></use>
</svg>
<svg viewBox="0 0 23 23" class="w-5 h-5">
<use xlink:href="#star"></use>
</svg>
<svg viewBox="0 0 23 23" class="w-5 h-5">
<use xlink:href="#star"></use>
</svg>
<svg viewBox="0 0 23 23" class="w-5 h-5">
<use xlink:href="#star"></use>
</svg>
</div>
<!-- fillable star based on width. Please calculate Percentage value ex: 10%, 20% -->
<div
class="overflow-hidden absolute left-0 top-0 text-[#FFC403] flex space-x-1"
style="width: 72%"
>
<svg
viewBox="0 0 23 23"
class="w-5 h-5 flex-shrink-0"
>
<use xlink:href="#star-filled"></use>
</svg>
<svg
viewBox="0 0 23 23"
class="w-5 h-5 flex-shrink-0"
>
<use xlink:href="#star-filled"></use>
</svg>
<svg
viewBox="0 0 23 23"
class="w-5 h-5 flex-shrink-0"
>
<use xlink:href="#star-filled"></use>
</svg>
<svg
viewBox="0 0 23 23"
class="w-5 h-5 flex-shrink-0"
>
<use xlink:href="#star-filled"></use>
</svg>
<svg
viewBox="0 0 23 23"
class="w-5 h-5 flex-shrink-0"
>
<use xlink:href="#star-filled"></use>
</svg>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment