Animated Fraction
A copy-paste stats & counters component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Stats & CountersHTMLCSSany framework
847/1,000
Seats filled
Copy into your project
HTML
<!-- Animated Fraction -->
<div class="nuda-sc2-fraction" role="img" aria-label="847 of 1,000 seats filled">
<div class="nuda-sc2-fraction__nums">
<span class="nuda-sc2-fraction__num">847</span>
<span class="nuda-sc2-fraction__slash">/</span>
<span class="nuda-sc2-fraction__den">1,000</span>
</div>
<div class="nuda-sc2-fraction__track">
<span class="nuda-sc2-fraction__fill" style="--f:84.7%"></span>
</div>
<span class="nuda-sc2-fraction__label">Seats filled</span>
</div>CSS
.nuda-sc2-fraction {
display: flex;
flex-direction: column;
gap: 6px;
padding: 10px;
width: 150px;
}
.nuda-sc2-fraction__nums {
display: flex;
align-items: baseline;
gap: 4px;
opacity: 0;
animation: _nuda-sc2fraction-pop .6s cubic-bezier(.4,0,.2,1) forwards;
}
.nuda-sc2-fraction__num {
font: 800 24px ui-sans-serif,system-ui;
color: #fafafa;
font-variant-numeric: tabular-nums;
line-height: 1;
}
.nuda-sc2-fraction__slash {
font: 500 16px ui-sans-serif,system-ui;
color: #555;
}
.nuda-sc2-fraction__den {
font: 600 13px ui-sans-serif,system-ui;
color: #a1a1aa;
font-variant-numeric: tabular-nums;
}
.nuda-sc2-fraction__track {
height: 6px;
background: rgba(255,255,255,.06);
border-radius: 3px;
overflow: hidden;
}
.nuda-sc2-fraction__fill {
display: block;
height: 100%;
width: var(--f);
background: linear-gradient(90deg,rgba(228,255,84,.6),#e4ff54);
border-radius: 3px;
transform: scaleX(0);
transform-origin: left;
animation: _nuda-sc2fraction-fill 1.3s cubic-bezier(.4,0,.2,1) .2s forwards;
}
.nuda-sc2-fraction__label {
font: 500 9px ui-sans-serif,system-ui;
color: #777;
text-transform: uppercase;
letter-spacing: .08em;
}
@keyframes _nuda-sc2fraction-pop {
from {
opacity: 0;
transform: translateY(6px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes _nuda-sc2fraction-fill {
to {
transform: scaleX(1);
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-sc2-fraction__nums {
animation: none !important;
opacity: 1;
transform: translateY(0);
}
.nuda-sc2-fraction__fill {
animation: none !important;
transform: scaleX(1);
}
}
How to use Animated Fraction
Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.
Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.