15 CSS Number Counter Animations
Stock Price Ticker
Dark Bloomberg-esque block with a massive Barlow Condensed price counting up to $924.18, a green sparkline drawing itself in, and live decimal micro-flicker. OHLC row counts up simultaneously. Built for fintech apps, portfolio trackers and trading dashboards.
Stock Price Ticker the 8th of 15 designs in the 15 CSS Number Counter Animations collection. The design pairs CSS styling with a small amount of JavaScript for interactivity. Copy the HTML, CSS and JavaScript panels below into your project — the JS is self-contained, has zero dependencies, and is safe to drop into any framework (React, Vue, Svelte, plain HTML). The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<div class="cnc-stk">
<div class="cnc-stk-block">
<div class="cnc-stk-ticker-head">
<span class="cnc-stk-ticker-sym">NVDA · NASDAQ</span>
<span class="cnc-stk-market-status"><div class="cnc-stk-ms-dot"></div>Open</span>
</div>
<div class="cnc-stk-price-row">
<span class="cnc-stk-currency">$</span>
<div class="cnc-stk-price"><span class="cnc-stk-price-int" data-target="924">0</span><span class="cnc-stk-price-dec">.<span class="cnc-stk-dec" data-target="18">00</span></span></div>
</div>
<div class="cnc-stk-change">
<span class="cnc-stk-change-val cnc-stk-up" data-chg-abs data-target="18.42">+0.00</span>
<span class="cnc-stk-change-pct cnc-stk-up" data-chg-pct data-target="2.03">+0.00%</span>
<span class="cnc-stk-change-time">May 19 · 14:32 ET</span>
</div>
<div class="cnc-stk-spark">
<svg width="100%" height="64" viewBox="0 0 320 64" preserveAspectRatio="none">
<defs><linearGradient id="cnc-stk-sparkGrad" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#22c55e" stop-opacity="0.15"/><stop offset="100%" stop-color="#22c55e" stop-opacity="0"/></linearGradient></defs>
<path fill="url(#cnc-stk-sparkGrad)" d="M0,52 L22,48 L44,50 L66,42 L88,44 L110,36 L132,38 L154,28 L176,32 L198,20 L220,24 L242,14 L264,18 L286,10 L320,8 L320,64 L0,64 Z"/>
<path class="cnc-stk-spark-line" d="M0,52 L22,48 L44,50 L66,42 L88,44 L110,36 L132,38 L154,28 L176,32 L198,20 L220,24 L242,14 L264,18 L286,10 L320,8"/>
</svg>
</div>
<div class="cnc-stk-ohlc">
<div class="cnc-stk-ohlc-item"><div class="cnc-stk-ohlc-label">Open</div><div class="cnc-stk-ohlc-val">$<span data-ohlc="open" data-target="905.76">0</span></div></div>
<div class="cnc-stk-ohlc-item"><div class="cnc-stk-ohlc-label">High</div><div class="cnc-stk-ohlc-val cnc-stk-ohlc-high">$<span data-ohlc="high" data-target="931.07">0</span></div></div>
<div class="cnc-stk-ohlc-item"><div class="cnc-stk-ohlc-label">Low</div><div class="cnc-stk-ohlc-val cnc-stk-ohlc-low">$<span data-ohlc="low" data-target="901.33">0</span></div></div>
<div class="cnc-stk-ohlc-item"><div class="cnc-stk-ohlc-label">Vol</div><div class="cnc-stk-ohlc-val"><span data-ohlc="vol" data-target="42.3">0</span>M</div></div>
</div>
</div>
</div> .cnc-stk { display: grid; place-items: center; padding: 32px 16px; background: #080c10; font-family: 'Barlow', sans-serif; }
.cnc-stk *, .cnc-stk *::before, .cnc-stk *::after { box-sizing: border-box; }
.cnc-stk-block { width: 400px; padding: 48px 40px; position: relative; }
.cnc-stk-block::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px); background-size: 32px 32px; pointer-events: none; }
.cnc-stk-ticker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; position: relative; }
.cnc-stk-ticker-sym { font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 5px; color: rgba(255,255,255,0.25); text-transform: uppercase; }
.cnc-stk-market-status { font-size: 9px; letter-spacing: 3px; text-transform: uppercase; color: #22c55e; display: flex; align-items: center; gap: 6px; }
.cnc-stk-ms-dot { width: 5px; height: 5px; background: #22c55e; border-radius: 50%; animation: cnc-stk-msBlink 2s ease-in-out infinite; box-shadow: 0 0 6px #22c55e; }
@keyframes cnc-stk-msBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.cnc-stk-price-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; opacity: 0; animation: cnc-stk-appear 0.6s cubic-bezier(0.22,1,0.36,1) 0.1s forwards; }
.cnc-stk-currency { font-family: 'Barlow Condensed', sans-serif; font-size: 28px; font-weight: 300; color: rgba(255,255,255,0.3); margin-top: 10px; }
.cnc-stk-price { font-family: 'Barlow Condensed', sans-serif; font-size: clamp(80px, 16vw, 108px); font-weight: 800; color: #fff; line-height: 1; letter-spacing: -3px; }
.cnc-stk-price-dec { font-size: 0.45em; font-weight: 400; letter-spacing: 0; color: rgba(255,255,255,0.6); align-self: flex-end; padding-bottom: 14px; }
.cnc-stk-change { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; opacity: 0; animation: cnc-stk-appear 0.5s ease 0.25s forwards; }
.cnc-stk-change-val { font-family: 'Barlow Condensed', sans-serif; font-size: 22px; font-weight: 600; letter-spacing: 0.5px; }
.cnc-stk-change-val.cnc-stk-up { color: #22c55e; }
.cnc-stk-change-val.cnc-stk-dn { color: #ef4444; }
.cnc-stk-change-pct { font-size: 13px; padding: 4px 10px; border-radius: 3px; font-family: 'Barlow Condensed', sans-serif; font-weight: 600; letter-spacing: 1px; }
.cnc-stk-change-pct.cnc-stk-up { background: rgba(34,197,94,0.12); color: #22c55e; }
.cnc-stk-change-time { font-size: 10px; color: rgba(255,255,255,0.2); letter-spacing: 1px; margin-left: auto; }
.cnc-stk-spark { margin-bottom: 32px; opacity: 0; animation: cnc-stk-appear 0.5s ease 0.4s forwards; }
.cnc-stk-spark svg { overflow: visible; }
.cnc-stk-spark-line { fill: none; stroke: #22c55e; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: cnc-stk-drawSpark 1.6s ease 0.6s forwards; }
@keyframes cnc-stk-drawSpark { to { stroke-dashoffset: 0; } }
.cnc-stk-ohlc { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid rgba(255,255,255,0.05); padding-top: 24px; opacity: 0; animation: cnc-stk-appear 0.5s ease 0.5s forwards; }
.cnc-stk-ohlc-item { border-right: 1px solid rgba(255,255,255,0.05); padding-right: 16px; }
.cnc-stk-ohlc-item:last-child { border-right: none; }
.cnc-stk-ohlc-label { font-size: 8px; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,0.2); margin-bottom: 6px; }
.cnc-stk-ohlc-val { font-family: 'Barlow Condensed', sans-serif; font-size: 18px; font-weight: 600; color: rgba(255,255,255,0.7); }
.cnc-stk-ohlc-high { color: #22c55e; }
.cnc-stk-ohlc-low { color: #ef4444; }
@keyframes cnc-stk-flash { 0% { color: #22c55e; } 100% { color: #fff; } }
.cnc-stk-flash { animation: cnc-stk-flash 0.6s ease forwards; }
@keyframes cnc-stk-appear { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
.cnc-stk-ms-dot, .cnc-stk-price-row, .cnc-stk-change, .cnc-stk-spark, .cnc-stk-spark-line, .cnc-stk-ohlc { animation: none; opacity: 1; transform: none; stroke-dashoffset: 0; }
} (function () {
var root = document.querySelector('.cnc-stk');
if (!root) return;
function ease(t) { return 1 - Math.pow(1 - t, 3); }
setTimeout(function () {
var start = performance.now(), dur = 2000;
var intEl = root.querySelector('.cnc-stk-price-int');
var decEl = root.querySelector('.cnc-stk-dec');
var chgAbs = root.querySelector('[data-chg-abs]');
var chgPct = root.querySelector('[data-chg-pct]');
var ohlc = root.querySelectorAll('[data-ohlc]');
var intTarget = parseFloat(intEl.dataset.target);
var decTarget = parseInt(decEl.dataset.target, 10);
var chgAbsTarget = parseFloat(chgAbs.dataset.target);
var chgPctTarget = parseFloat(chgPct.dataset.target);
function tick(now) {
var t = Math.min((now - start) / dur, 1), e = ease(t);
intEl.textContent = Math.floor(e * intTarget).toLocaleString();
decEl.textContent = String(Math.round(e * decTarget)).padStart(2, '0');
chgAbs.textContent = '+' + (e * chgAbsTarget).toFixed(2);
chgPct.textContent = '+' + (e * chgPctTarget).toFixed(2) + '%';
ohlc.forEach(function (el) {
var target = parseFloat(el.dataset.target);
el.textContent = (e * target).toFixed(el.dataset.ohlc === 'vol' ? 1 : 2);
});
if (t < 1) requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
}, 300);
function flicker() {
var el = root.querySelector('.cnc-stk-dec');
var next = Math.max(0, Math.min(99, Math.round(Math.random() * 99)));
el.textContent = String(next).padStart(2, '0');
el.classList.remove('cnc-stk-flash');
void el.offsetWidth;
el.classList.add('cnc-stk-flash');
setTimeout(flicker, 800 + Math.random() * 1200);
}
setTimeout(flicker, 2600);
})();