Skip to content

FAQ with helpfulness vote in HTML and CSS

A native accordion FAQ where each answer asks “Was this answer helpful?”, with a thank-you message and a remembered vote.

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>FAQ avec vote « utile »</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <section class="fvu" data-fvu aria-labelledby="fvu-titre">
        <h2 class="fvu-title" id="fvu-titre">Questions fréquentes</h2>
script.js
document.querySelectorAll("[data-fvu]").forEach((root) => {
  const on = (el, type, fn) => el.addEventListener(type, fn);
  const KEY = "forge-fvu-votes";
  let votes = {};
  try {
    votes = JSON.parse(localStorage.getItem(KEY) ?? "{}");
  } catch {
    votes = {};
  }
  const MESSAGES = {
    oui: "Merci pour votre retour !",
    non: "Merci, nous allons améliorer cette réponse. Vous pouvez aussi nous écrire avec le lien en bas de page.",
style.css
:root {
  --fvu-card: #ffffff;
  --fvu-text: #10233a;
  --fvu-muted: #46566b;
  --fvu-line: #d5dee8;
  --fvu-soft: #f1f6fb;
  --fvu-accent: #0b5cad;
  --fvu-accent-text: #ffffff;
  --demo-bg: #e9eff5;
  --demo-text: #10233a;
}

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

FAQ and accordions components in HTML and CSS
  • An introduction and a contact link on the left, expandable questions on the right.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A tight accordion within a single frame, for practical information pages.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Questions grouped under subheadings, for long FAQs.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • All answers visible at once, presented as a card grid.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Frequently asked questions followed by a card inviting visitors to call or write.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Questions that expand one by one, with FAQPage structured data for Google.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component