Reading progress bar in HTML and CSS
A blog article topped by a thin bar that fills up as the reader moves through the text.
Here is an excerpt of this component's code in HTML and CSS. The full code is free for members, ready to copy into your project.
This component also comes in
The code in HTML and CSS
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Barre de progression de lecture</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<article class="efpl" data-efpl aria-labelledby="efpl-titre">
<span class="efpl__bar" aria-hidden="true"><span class="efpl__fill"></span></span>// Firefox does not support view timelines yet: replay the same range by hand.
if (!CSS.supports("animation-timeline: view()")) {
const reduce = matchMedia("(prefers-reduced-motion: reduce)");
document.querySelectorAll("[data-efpl]").forEach((root) => {
const bar = root.firstElementChild;
const fill = bar.firstElementChild;
const update = () => {
bar.style.display = reduce.matches ? "" : "block";
// "contain" range: from the article filling the viewport to its end reaching the viewport bottom.
const box = root.getBoundingClientRect();
const start = Math.max(0, innerHeight - box.height);
const end = Math.min(0, innerHeight - box.height);:root {
--efpl-bg: #ffffff;
--efpl-border: #e7e5e4;
--efpl-text: #1c1917;
--efpl-body: #44403c;
--efpl-track: #f5f5f4;
--efpl-fill-start: #ea580c;
--efpl-fill-end: #9a3412;
--efpl-accent: #9a3412;
--efpl-on-accent: #ffffff;
--demo-bg: #f5f5f4;
--demo-text: #1c1917;Free component: copy it freely, including for commercial projects.
Other visual effects components in HTML and CSS
Visual effects components in HTML and CSS
A large heading whose words turn from grey to ink as the page scrolls, then whose key phrases get a marker stroke, in pure CSS with a readable fallback.
- Tailwind
- React
- CSS
- WordPress

Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.
- Tailwind
- React
- CSS
- WordPress

A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.
- Tailwind
- React
- CSS
- WordPress

A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.
- Tailwind
- React
- CSS
- WordPress

A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.
- Tailwind
- React
- CSS
- WordPress

Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.
- Tailwind
- React
- CSS
- WordPress