Reviews filtered by rating in HTML and CSS
A customer reviews section with average rating and star distribution; each bar is a button that filters the reviews with that rating.
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
The code in HTML and CSS
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Avis filtrables par note</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<section class="tfn" data-tfn aria-labelledby="tfn-titre">
<div class="tfn-summary">document.querySelectorAll("[data-tfn]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const buttons = [...root.querySelectorAll("[data-tfn-filter]")];
const cards = [...root.querySelectorAll("[data-tfn-note]")];
const count = root.querySelector("[data-tfn-count]");
root.querySelector("[data-tfn-bars]").hidden = false;
buttons.forEach((button) => {
on(button, "click", () => {
// A second press on the active note brings every review back.
const active = button.getAttribute("aria-pressed") !== "true";
buttons.forEach((b) => b.setAttribute("aria-pressed", String(active && b === button)));:root {
--tfn-bg: #f6f4ef;
--tfn-card: #ffffff;
--tfn-text: #22201b;
--tfn-muted: #57524a;
--tfn-line: #e4dfd5;
--tfn-track: #ebe6dc;
--tfn-star: #a16207;
--tfn-accent: #1e3a8a;
--tfn-pressed: #e8edfb;
--demo-bg: #ece8df;
--demo-text: #22201b;Free component: copy it freely, including for commercial projects.
Other testimonials components in HTML and CSS
Testimonials components in HTML and CSS
A reviews section for local shops: average star rating out of 5, a star breakdown that animates into view and the three latest reviews signed with a first name and a town.
- Tailwind
- React
- CSS
- WordPress

A CSS-drawn video poster with a play button, the testimonial's key quote, its author, and the timestamped transcript in a collapsible panel.
- Tailwind
- React
- CSS
- WordPress

Three customer reviews as cards, with star rating and customer tenure.
- Tailwind
- React
- CSS
- WordPress

A row of client references as wordmarks, followed by a representative quote.
- Tailwind
- React
- CSS
- WordPress

A single highlighted quote, with the name and role of its author.
- Tailwind
- React
- CSS
- WordPress