Skip to content

All-access offer card with places left 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.

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 offre accès total avec places restantes</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <article class="coa" aria-labelledby="coa-titre" data-coa data-coa-total="24" data-coa-left="7" data-coa-state="open">
        <p class="coa__eyebrow">Saison 2027, de janvier à décembre</p>
script.js
(() => {
  const NB = "\u00a0";
  const whole = (value, fallback) => {
    const number = Math.floor(Number(value));
    return value === undefined || value === "" || !Number.isFinite(number) ? fallback : number;
  };

  document.querySelectorAll("[data-coa]").forEach((root) => {
    const leftText = root.querySelector("[data-coa-left-text]");
    const ofText = root.querySelector("[data-coa-of]");
    const fill = root.querySelector("[data-coa-fill]");
    const book = root.querySelector("[data-coa-book]");
style.css
:root {
  --coa-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --coa-page: #f4f1ea;
  --coa-bg: #ffffff;
  --coa-text: #1f1b16;
  --coa-muted: #575047;
  --coa-edge: #ddd5c7;
  --coa-accent: #9a3412;
  --coa-on-accent: #ffffff;
  --coa-track: #ebe4d8;
  --coa-low: #b4231b;
  --coa-badge: #fde68a;

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

Cards components in HTML and CSS
  • 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 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.

    • 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