Underlined tabs in HTML and CSS
Understated tabs with an underlined active tab, to organize the information on a product page.
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>Onglets soulignés</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<main class="demo">
<div class="utabs" data-tabs>
<div class="utabs__list" role="tablist" aria-label="Informations sur le produit" hidden>:root {
--ut-text: #0b1b3a;
--ut-muted: #46577a;
--ut-line: #d6e0f5;
--ut-active: #1d4ed8;
--ut-ring: #1d4ed8;
--demo-bg: #f8faff;
--demo-text: #0b1b3a;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {document.querySelectorAll("[data-tabs]").forEach((root) => {
const list = root.querySelector('[role="tablist"]');
const tabs = [...list.querySelectorAll('[role="tab"]')];
const panels = tabs.map((tab) => document.getElementById(tab.getAttribute("aria-controls")));
const vertical = list.getAttribute("aria-orientation") === "vertical";
function select(index, focus) {
tabs.forEach((tab, position) => {
const selected = position === index;
tab.setAttribute("aria-selected", String(selected));
tab.tabIndex = selected ? 0 : -1;
panels[position].hidden = !selected;Free component: copy it freely, including for commercial projects.
Other tabs components in HTML and CSS
Tabs components in HTML and CSS
Accessible tabs on large screens that turn into an accordion on phones, with the right ARIA roles in each mode.
- Tailwind
- React
- CSS
- WordPress

Indicative prices sorted by trade in tabs, with the unit of each service, a VAT-inclusive / excl. switch and a free-quote notice.
- Tailwind
- React
- CSS
- WordPress

Two tabs to show different opening hours by season, in a compact card.
- Tailwind
- React
- CSS
- WordPress

A dark code block with one tab per package manager, for technical documentation.
- Tailwind
- React
- CSS
- WordPress