Skip to content

Team filtered by trade in HTML and CSS

A team presentation filtered by trade in one click, with the number of people announced to screen readers.

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>Équipe filtrable par métier</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <section class="efm" data-efm aria-labelledby="efm-titre">
        <h2 class="efm-title" id="efm-titre">L’équipe Atelier Marchal</h2>
script.js
document.querySelectorAll("[data-efm]").forEach((root) => {
  const on = (el, type, fn) => el.addEventListener(type, fn);
  const filters = [...root.querySelectorAll("[data-efm-filter]")];
  const cards = [...root.querySelectorAll("[data-efm-trade]")];
  const count = root.querySelector("[data-efm-count]");
  root.querySelector("[data-efm-filters]").hidden = false;

  filters.forEach((button) => {
    on(button, "click", () => {
      const trade = button.dataset.efmFilter;
      filters.forEach((b) => b.setAttribute("aria-pressed", String(b === button)));
      let shown = 0;
style.css
:root {
  --efm-card: #ffffff;
  --efm-text: #1c1d22;
  --efm-muted: #4d505c;
  --efm-line: #dcdde3;
  --efm-bg: #f5f5f7;
  --efm-accent: #1c1d22;
  --efm-accent-text: #ffffff;
  --demo-bg: #ececf0;
  --demo-text: #1c1d22;
}

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

Teams components in HTML and CSS
  • Four team members with portrait, name, role and a link to their professional profile.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component