Dismissible announcement bar in HTML and CSS
A slim bar at the top of the page with a message, a link and a close button; once closed, it stays hidden for the period you choose.
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>Bandeau d'annonce fermable</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<div class="bafm" id="bafm-conges-fin-annee" role="region" aria-label="Annonce" data-bafm data-bafm-id="conges-fin-annee" data-bafm-days="30">
<div class="bafm__inner">document.querySelectorAll("[data-bafm]").forEach((bar) => {
const id = bar.dataset.bafmId || "annonce";
const key = `forge-annonce:${id}`;
const days = Number(bar.dataset.bafmDays) || 0;
const until = bar.dataset.bafmUntil;
const close = bar.querySelector("[data-bafm-close]");
// Restore buttons usually come later in the page than this script: look them up on each render.
const restores = () => document.querySelectorAll(`[data-bafm-restore="${id}"]`);
// After the end date (last day included) the bar disappears on its own, without any storage.
const expired = Boolean(until) && Date.now() > new Date(`${until}T23:59:59`).getTime();
const read = () => {:root {
--bafm-bg: #1f2a44;
--bafm-text: #ffffff;
--bafm-line: #1f2a44;
--bafm-accent: #ffd48a;
--bafm-hover: rgb(255 255 255 / 0.15);
--bafm-page-muted: #57534e;
--bafm-action: #1f2a44;
--demo-bg: #f6f3ee;
--demo-text: #1c1917;
}
Free component: copy it freely, including for commercial projects.
Other breadcrumbs and pagination components in HTML and CSS
Breadcrumbs and pagination components in HTML and CSS
A bottom bar with Call, Directions and Free quote that tucks away while visitors read down the page and returns as soon as they scroll up. Built for tradespeople whose customers arrive on a phone.
- Tailwind
- React
- CSS
- WordPress

A sticky sidebar table of contents for blog posts: it highlights the section being read, shows the reading time left and folds into a list under the title on mobile.
- Tailwind
- React
- CSS
- WordPress

A column of dots on the side of the page that follows the section being read and lets visitors jump to it, with a label on hover and focus.
- Tailwind
- React
- CSS
- WordPress

Step indicator
FreeAn order step indicator: finished steps clickable to go back, the current step announced, upcoming steps locked.
- Tailwind
- React
- CSS
- WordPress

Tooltips in four positions that open on hover, tap and keyboard focus, and close with Escape, as WCAG requires.
- Tailwind
- React
- CSS
- WordPress

Quick access links that appear on the first Tab press to skip the header and menu, as required by the RGAA and WCAG.
- Tailwind
- React
- CSS
- WordPress