Skip to content

Call-now button with a clickable number in HTML and CSS

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

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

call-card.js
const DAYS = ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"];

function apmTime(minutes) {
  const m = minutes % 60;
  return `${Math.floor(minutes / 60)} h${m ? ` ${String(m).padStart(2, "0")}` : ""}`;
}

// Works out whether the line is answered now and, if not, when it is answered again (up to a week ahead).
function apmStatus(hours, now) {
  const day = now.getDay();
  const minutes = now.getHours() * 60 + now.getMinutes();
  const current = hours[day].find(([start, end]) => minutes >= start && minutes < end);
index.html
<!doctype html>
<html lang="fr">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Bouton « Appeler maintenant » avec numéro cliquable</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <section class="apm" aria-labelledby="apm-titre" data-apm data-apm-hours="[[],[[450,1140]],[[450,1140]],[[450,1140]],[[450,1140]],[[450,1140]],[[480,720]]]">
        <div class="apm__main">
style.css
:root {
  --apm-text: #1c1917;
  --apm-body: #44403c;
  --apm-line: #e7e5e4;
  --apm-surface: #ffffff;
  --apm-aside: #faf7f2;
  --apm-shadow: 0 18px 40px -24px rgb(28 25 23 / 0.35);
  --apm-accent: #c2410c;
  --apm-call-bg: #c2410c;
  --apm-call-hover: #9a3412;
  --apm-call-text: #ffffff;
  --apm-copy-border: #d6d3d1;

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

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
    Component
  • 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
    Component
  • 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.

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

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

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component