Skip to content

Seasonal offer card in HTML and CSS

A seasonal promotion card with a struck-through price and discount that announces by itself whether the offer is coming, how many days are left or that it is over.

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

Open in a new tab

The code in HTML and CSS

index.html
<!doctype html>
<html lang="fr">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Carte d’offre saisonnière</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <article class="cop" data-cop data-cop-start="2026-11-23" data-cop-end="2026-12-31" aria-labelledby="cop-titre">
        <div class="cop-visual" aria-hidden="true"><span class="cop-percent">−20 %</span></div>
script.js
document.querySelectorAll("[data-cop]").forEach((root) => {
  const on = (el, type, fn) => el.addEventListener(type, fn);
  const now = new Date();
  const parse = (iso) => {
    const [y, m, d] = iso.split("-").map(Number);
    return new Date(y, m - 1, d);
  };
  const start = parse(root.dataset.copStart);
  const end = parse(root.dataset.copEnd);
  const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  const badge = root.querySelector("[data-cop-badge]");
  const days = Math.round((end.getTime() - today.getTime()) / 86400000);
style.css
:root {
  --cop-card: #ffffff;
  --cop-text: #22191f;
  --cop-muted: #5a4d55;
  --cop-accent: #9d174d;
  --cop-accent-text: #ffffff;
  --cop-soft: #fdf2f6;
  --cop-visual: linear-gradient(135deg, #831843, #be185d 55%, #f59e0b);
  --demo-bg: #f4ecf0;
  --demo-text: #22191f;
}

Free component: copy it freely, including for commercial projects.

Cards components in HTML and CSS
  • A single-plan pricing card: struck-through price and discount, a places-left gauge driven by a data attribute, the list of everything included and a booking button that turns into a waiting list once sold out.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Three treatment cards in accessible neumorphism: gently raised surfaces, buttons that sink in when activated, a light/dark switch for the block itself. 3:1 outlines and AA text kept.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four fully clickable workshop cards in a neo-brutalist style: thick border, solid offset shadow and a card that sinks onto its shadow on hover or focus. Pastel tones, dark mode, no JavaScript.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Three brutalist service cards: one-pixel border, hard offset shadow that lifts on hover and sinks on click, large type, accent and dark variants. No JavaScript.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A mobile page to link from your social profiles: portrait, name, priority links (booking, WhatsApp, website, reviews, call), opening hours with an open or closed status, social links and a share button, in dependency-free HTML and CSS.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A 24-door Advent calendar where each surprise only opens from its day in December, with opened doors remembered.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component