Bottom cookie banner in HTML and CSS
A full-width banner pinned to the bottom of the screen, with refuse, customize and accept on the same level.
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
const STORAGE_KEY = "forge-consent";
// The CNIL recommends asking again after six months.
const MAX_AGE = 1000 * 60 * 60 * 24 * 182;
function readConsent() {
try {
const stored = JSON.parse(localStorage.getItem(STORAGE_KEY));
return stored && Date.now() - Date.parse(stored.date) < MAX_AGE ? stored : null;
} catch {
return null;
}
}<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Bandeau de cookies en bas de page</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<div data-consent-root>
<section class="ckb" data-consent aria-labelledby="cookies-bandeau-bas-title">:root {
--ck-bg: #ffffff;
--ck-text: #0b1b3a;
--ck-muted: #46577a;
--ck-line: #c9d6f2;
--ck-btn: #1d4ed8;
--ck-btn-text: #ffffff;
--ck-accent: #1d4ed8;
--ck-ring: #1d4ed8;
--ck-radius: 10px;
--demo-bg: #eef2fb;
--demo-text: #0b1b3a;Free component: copy it freely, including for commercial projects.
Other cookie banners components in HTML and CSS
Cookie banners components in HTML and CSS
A rounded dark bar floating at the bottom of the screen, text on the left and buttons on the right on large screens.
- Tailwind
- React
- CSS
- WordPress

An understated banner with square corners and a thick rule, suited to local authorities, firms and public institutions.
- Tailwind
- React
- CSS
- WordPress

A floating card in the bottom-left corner, discreet yet always visible.
- Tailwind
- React
- CSS
- WordPress

A banner at the top of the page, in the document flow, that never hides content.
- Tailwind
- React
- CSS
- WordPress