Skip to content

Google reviews card in HTML and CSS

A Google reviews summary block: average star rating, review count and breakdown, expandable recent reviews and a link to leave a review, with schema.org structured data.

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'avis Google</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <section class="gavis" aria-labelledby="gavis-title" data-gavis>
        <div class="gavis__head">
reviews.js
document.querySelectorAll("[data-gavis]").forEach((card) => {
  card.querySelectorAll("[data-gavis-read]").forEach((button) => {
    const rest = document.getElementById(button.getAttribute("aria-controls"));
    const dots = button.parentElement.querySelector("[data-gavis-dots]");
    rest.hidden = true;
    dots.hidden = false;
    button.hidden = false;
    button.addEventListener("click", () => {
      const open = button.getAttribute("aria-expanded") !== "true";
      button.setAttribute("aria-expanded", String(open));
      rest.hidden = !open;
      dots.hidden = open;
style.css
:root {
  --gavis-text: #1f2937;
  --gavis-muted: #4b5563;
  --gavis-card: #ffffff;
  --gavis-soft: #f8fafc;
  --gavis-line: #e5e7eb;
  --gavis-border: #cbd5e1;
  --gavis-track: #e5e7eb;
  --gavis-star: #b45309;
  --gavis-star-off: #d1d5db;
  --gavis-accent: #1d4ed8;
  --gavis-accent-hover: #1e40af;

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 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