Countdown CTA in HTML and CSS
A call to action for a limited offer: serif heading, two links and a countdown in days, hours and minutes inside a coupon-style frame.
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
document.querySelectorAll("[data-countdown]").forEach((root) => {
const fixed = root.dataset.deadline ? new Date(root.dataset.deadline) : null;
const units = root.querySelector("[data-countdown-units]");
const ended = root.querySelector("[data-countdown-ended]");
const pad = (n) => String(n).padStart(2, "0");
// Without a fixed date the offer renews every week and ends on Sunday at midnight.
function deadline(now) {
if (fixed) return fixed;
const end = new Date(now);
end.setHours(23, 59, 59, 999);
end.setDate(end.getDate() + ((7 - end.getDay()) % 7));<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CTA compte à rebours</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<section class="cdown" aria-labelledby="cdown-title" data-countdown>
<div class="cdown__text">:root {
--cdown-bg: #991b1b;
--cdown-text: #fff7ed;
--cdown-muted: #fecaca;
--cdown-cream: #fef3c7;
--cdown-tile: #7f1d1d;
--cdown-button: #fef3c7;
--cdown-button-hover: #ffffff;
--cdown-button-text: #7f1d1d;
--cdown-ring: #fef3c7;
--demo-bg: #fef2f2;
--demo-text: #450a0a;Free component: copy it freely, including for commercial projects.
Other calls to action components in HTML and CSS
Calls to action components in HTML and CSS
A promotional card for a course, a workshop or an opening: remaining seats, a fill bar, the registration deadline and a booking button, with no countdown timer.
- Tailwind
- React
- CSS
- WordPress

A Free quote within 24 hours banner with a request button, a clickable phone number and three guarantees (no commitment, fast reply, free visit), with no JavaScript.
- Tailwind
- React
- CSS
- WordPress

A desktop contact card with a clickable tel: number, a live Available badge and response hours, for tradespeople who want to be phoned directly.
- Tailwind
- React
- CSS
- WordPress

A direct-call block for emergencies, with the number in very large type and response times.
- Tailwind
- React
- CSS
- WordPress

A sign-up box with an email field, a button and a note on how the address is used.
- Tailwind
- React
- CSS
- WordPress

A full-width band with a heading, a sentence and two action buttons.
- Tailwind
- React
- CSS
- WordPress