CSS Stat Card
A clean dashboard metric card with a big number and a trend badge.
Monthly visitors
48,210 ▲ 12.4%HTML
<div class="stat-card">
<p>Monthly visitors</p>
<strong>48,210</strong>
<span class="stat-up">▲ 12.4%</span>
</div>
CSS
.stat-card {
width: 200px;
padding: 18px 20px;
border: 1px solid #e5e7eb;
border-radius: 16px;
background: #fff;
font-family: system-ui, sans-serif;
}
.stat-card p {
margin: 0;
color: #6b7280;
font-size: 13px;
font-weight: 500;
}
.stat-card strong {
display: block;
margin: 6px 0 10px;
color: #111;
font-size: 30px;
font-variant-numeric: tabular-nums;
letter-spacing: -0.02em;
}
.stat-up {
display: inline-block;
padding: 3px 8px;
border-radius: 999px;
background: #dcfce7;
color: #15803d;
font-size: 12px;
font-weight: 700;
}
About this CSS Stat Card
This CSS Stat Card is 34 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
Customize it
The colors in this snippet. Search and replace them to match your brand:
#e5e7eb#fff#6b7280#111#dcfce7#15803d
How to use this stat card
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.stat-cardclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.