Population Pyramid Chart
Age bands stacked around a centred label column, with one bar growing left and one growing right so the two populations can be compared band by band.
- lines of CSS
- 47lines of CSS
- dependencies
- 0dependencies
- browser, for years
- Everybrowser, for years
- motion only on interaction
- Hovermotion only on interaction
Vue, Svelte, styled-components and Tailwind exports are part of Pro. HTML, CSS and React are free forever.
.fx-v14-ch-pyramid-15792 {
width: 246px;
color: #cbd5e1;
}
.fx-v14-ch-pyramid-15792 .hd, .fx-v14-ch-pyramid-15792 .ax {
display: grid;
grid-template-columns: 1fr 46px 1fr;
align-items: center;
font-size: 0.58rem;
color: #64748b;
}
.fx-v14-ch-pyramid-15792 .hd { margin-bottom: 0.3rem; }
.fx-v14-ch-pyramid-15792 .ax { margin-top: 0.3rem; }
.fx-v14-ch-pyramid-15792 .hd span:last-child, .fx-v14-ch-pyramid-15792 .ax span:last-child { text-align: right; }
.fx-v14-ch-pyramid-15792 .hd em, .fx-v14-ch-pyramid-15792 .ax em { font-style: normal; text-align: center; }
.fx-v14-ch-pyramid-15792 .r {
display: grid;
grid-template-columns: 1fr 46px 1fr;
align-items: center;
margin-bottom: 4px;
}
.fx-v14-ch-pyramid-15792 .r b {
font-size: 0.57rem;
font-weight: 500;
text-align: center;
color: #94a3b8;
font-variant-numeric: tabular-nums;
}
.fx-v14-ch-pyramid-15792 .r i {
display: block;
width: var(--w);
height: 13px;
transition: filter 0.22s ease, transform 0.22s ease;
}
.fx-v14-ch-pyramid-15792 .l {
justify-self: end;
border-radius: 2px 0 0 2px;
background: linear-gradient(90deg, #0369a1, #38bdf8);
transform-origin: right center;
}
.fx-v14-ch-pyramid-15792 .t {
border-radius: 0 2px 2px 0;
background: linear-gradient(90deg, #a78bfa, #6d28d9);
transform-origin: left center;
}
.fx-v14-ch-pyramid-15792 .r:hover i { filter: brightness(1.3); transform: scaleX(1.05); }
.fx-v14-ch-pyramid-15792 .r:hover b { color: #f1f5f9; }<div class="fx-v14-ch-pyramid-15792">
<div class="hd">
<span>Men</span>
<em>Age</em>
<span>Women</span>
</div>
<div class="r">
<i class="l" style="--w:34%"></i>
<b>65+</b>
<i class="t" style="--w:48%"></i>
</div>
<div class="r">
<i class="l" style="--w:52%"></i>
<b>50-64</b>
<i class="t" style="--w:58%"></i>
</div>
<div class="r">
<i class="l" style="--w:78%"></i>
<b>35-49</b>
<i class="t" style="--w:72%"></i>
</div>
<div class="r">
<i class="l" style="--w:96%"></i>
<b>20-34</b>
<i class="t" style="--w:88%"></i>
</div>
<div class="r">
<i class="l" style="--w:61%"></i>
<b>0-19</b>
<i class="t" style="--w:64%"></i>
</div>
<div class="ax">
<span>8%</span>
<em>0</em>
<span>8%</span>
</div>
</div>What do I do with this?
- Put
population-pyramid-chart-15793.cssanywhere your page already loads CSS from — in Next.js that isapp/globals.css, or any stylesheet with a<link>in your HTML. - Then put the class on the element you want it on:
<button class="fx-v14-ch-pyramid-15792">. The CSS does nothing until a class name in it matches something on the page.
- Link the stylesheet, then paste the markup wherever you need it.
npx hoverlab add population-pyramid-chart-15793What's included
- The markup and the stylesheet, in whichever framework you pick
- No runtime dependencies
Works with
- React
- Vue
- Svelte
- Tailwind
- styled-components
- Plain CSS
npx hoverlab add population-pyramid-chart-15793
Or over MCP, from your editor's agent — no account needed.
License
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Motion safety
Static estimate, read from the CSS
- Reduced motion
- Brief motion, no guard
Animates briefly or on interaction. Only looping motion gets a guard in this catalog; copy the one from the Insights tab if this ships on a critical path.
- What it animates
- Compositor only
Only
transform,opacityorfilter: the GPU can run it without re-laying-out or repainting the page. - Flashing (WCAG 2.3.1)
- No flashing found
No repeating change in opacity, colour or brightness large enough to count as a flash.
- Layout shift (CLS)
- No shift expected
Nothing it animates moves or resizes the box in flow. A category from the CSS, not a measurement for this effect.
Every row is read from the shipped CSS. Only a figure marked measured came from a browser. Customizing the speed changes the timing, so recheck a customized copy. How it is computed
35 more effects in Charts & Data
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse Charts & DataShipping one commercially
Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
- A commercial licence for everything in the catalog
- Unlimited bundle exports, in Vue, Svelte and Tailwind
- One payment — no subscription, nothing to renew
7 variations of Population Pyramid Chart
Finished looks, each one a position in the customizer above. Copy any of them, or open it and keep moving the sliders.