Category-banded comparison table in HTML, CSS and vanilla JS
A copy-paste Category-banded comparison table in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="dcl-comparison-table-category-bands-root" aria-label="Category-banded comparison table" data-dcl-scheme="light">
<h2>Compare archive access</h2><div class="dcl-comparison-table-category-bands-stack"><div class="dcl-comparison-table-category-bands-scroll"><table><caption>Collaboration</caption><thead><tr><th scope="col">Feature</th><th scope="col">Solo</th><th scope="col">Studio</th><th scope="col">Network</th></tr></thead><tbody><tr><th scope="row">Offline edits</th><td>Read only</td><td>Read and write</td><td>Read and write</td></tr><tr><th scope="row">Reviewers</th><td>1 included</td><td>5 included</td><td>Unlimited</td></tr></tbody></table></div>
<div class="dcl-comparison-table-category-bands-scroll"><table><caption>Retention and portability</caption><thead><tr><th scope="col">Feature</th><th scope="col">Solo</th><th scope="col">Studio</th><th scope="col">Network</th></tr></thead><tbody><tr><th scope="row">History</th><td>7 days</td><td>90 days</td><td>1 year</td></tr><tr><th scope="row">Export</th><td>CSV</td><td>CSV and PDF</td><td>CSV, PDF and XML</td></tr></tbody></table></div></div>
<script>
(() => {
const root = document.currentScript.closest(".dcl-comparison-table-category-bands-root");
const preference = matchMedia("(prefers-color-scheme: dark)");
const apply = () => {
root.dataset.dclScheme = document.documentElement.dataset.theme || (preference.matches ? "dark" : "light");
};
preference.addEventListener("change", apply);
apply();
root.querySelectorAll(".dcl-comparison-table-category-bands-scroll").forEach((viewport) => {
const table = viewport.querySelector("table");
const caption = table.caption.textContent;
const observer = new ResizeObserver(() => {
if (viewport.scrollWidth > viewport.clientWidth + 1) {
viewport.tabIndex = 0;
viewport.setAttribute("role", "region");
viewport.setAttribute("aria-label", caption + " — scrollable table");
} else {
viewport.removeAttribute("tabindex");
viewport.removeAttribute("role");
viewport.removeAttribute("aria-label");
}
});
observer.observe(viewport);
observer.observe(table);
});
})();
</script>
</section>
<style>
.dcl-comparison-table-category-bands-root { color: #11292f; background-color: #ffffff; color-scheme: light; }
.dcl-comparison-table-category-bands-root .dcl-comparison-table-category-bands-panel, .dcl-comparison-table-category-bands-root .dcl-comparison-table-category-bands-badge,
.dcl-comparison-table-category-bands-root button, .dcl-comparison-table-category-bands-root input, .dcl-comparison-table-category-bands-root select, .dcl-comparison-table-category-bands-root summary {
color: #11292f; background-color: #e4edef; border-color: #697f84;
}
.dcl-comparison-table-category-bands-root .dcl-comparison-table-category-bands-muted { color: #405a60; }
.dcl-comparison-table-category-bands-root button:hover, .dcl-comparison-table-category-bands-root button[aria-pressed="true"], .dcl-comparison-table-category-bands-root summary:hover {
color: #ffffff; background-color: #00535a;
}
.dcl-comparison-table-category-bands-root a { color: #005c62; }
.dcl-comparison-table-category-bands-root :focus-visible { outline: 3px solid #005c62; outline-offset: 3px; }
.dcl-comparison-table-category-bands-root { --edge: #697f84; --accent: #00535a; }
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; color-scheme: dark; }
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] .dcl-comparison-table-category-bands-panel, .dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] .dcl-comparison-table-category-bands-badge,
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] button, .dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] input, .dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] select, .dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] summary {
color: #eff8f9; background-color: #1c3c44; border-color: #839fa5;
}
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] .dcl-comparison-table-category-bands-muted { color: #b0c9ce; }
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] button:hover, .dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] button[aria-pressed="true"], .dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] summary:hover {
color: #11292f; background-color: #8fe1da;
}
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] a { color: #8fe1da; }
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 3px; }
.dcl-comparison-table-category-bands-root[data-dcl-scheme="dark"] { --edge: #839fa5; --accent: #8fe1da; }
.dcl-comparison-table-category-bands-root { display: grid; gap: 1rem; box-sizing: border-box; max-inline-size: 60rem; margin-inline: auto; padding: clamp(0.875rem, 3vw, 2rem);
border: 1px solid var(--edge); border-radius: 0.75rem; font: 1rem/1.55 system-ui, sans-serif; overflow-wrap: anywhere; }
.dcl-comparison-table-category-bands-root * { box-sizing: border-box; min-inline-size: 0; }
.dcl-comparison-table-category-bands-root h2, .dcl-comparison-table-category-bands-root h3, .dcl-comparison-table-category-bands-root p, .dcl-comparison-table-category-bands-root ul, .dcl-comparison-table-category-bands-root ol, .dcl-comparison-table-category-bands-root dl, .dcl-comparison-table-category-bands-root dd, .dcl-comparison-table-category-bands-root figure, .dcl-comparison-table-category-bands-root blockquote, .dcl-comparison-table-category-bands-root fieldset { margin: 0; }
.dcl-comparison-table-category-bands-root h2 { font-size: clamp(1.375rem, 3vw, 2rem); line-height: 1.18; }
.dcl-comparison-table-category-bands-root h3 { font-size: 1.125rem; line-height: 1.3; }
.dcl-comparison-table-category-bands-root ul, .dcl-comparison-table-category-bands-root ol { padding: 0; list-style: none; }
.dcl-comparison-table-category-bands-panel > * + *, .dcl-comparison-table-category-bands-disclosure > * + * { margin-block-start: 0.65rem; }
.dcl-comparison-table-category-bands-stack, .dcl-comparison-table-category-bands-grid, .dcl-comparison-table-category-bands-split, .dcl-comparison-table-category-bands-rail { display: grid; gap: 1rem; align-items: start; }
.dcl-comparison-table-category-bands-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.dcl-comparison-table-category-bands-split { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.dcl-comparison-table-category-bands-rail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.dcl-comparison-table-category-bands-bar { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center; }
.dcl-comparison-table-category-bands-spread { justify-content: space-between; }
.dcl-comparison-table-category-bands-panel { padding: 1rem; border: 1px solid var(--edge); border-radius: 0.625rem; }
.dcl-comparison-table-category-bands-badge { display: inline-block; width: fit-content; border: 1px solid var(--edge); border-radius: 1rem;
padding: 0.16rem 0.65rem; font-size: 0.875rem; font-weight: 650; }
.dcl-comparison-table-category-bands-muted { font-size: 0.875rem; }
.dcl-comparison-table-category-bands-root button, .dcl-comparison-table-category-bands-root input, .dcl-comparison-table-category-bands-root select, .dcl-comparison-table-category-bands-root summary {
font: inherit; padding: 0.45rem 0.7rem; border: 1px solid; border-radius: 0.375rem; max-inline-size: 100%; }
.dcl-comparison-table-category-bands-root input[type="checkbox"], .dcl-comparison-table-category-bands-root input[type="radio"] { inline-size: 1.15rem; block-size: 1.15rem; accent-color: var(--accent); }
.dcl-comparison-table-category-bands-root button, .dcl-comparison-table-category-bands-root select, .dcl-comparison-table-category-bands-root summary, .dcl-comparison-table-category-bands-root label { cursor: pointer; }
.dcl-comparison-table-category-bands-root button:disabled { cursor: not-allowed; border-style: dashed; }
.dcl-comparison-table-category-bands-root button:active, .dcl-comparison-table-category-bands-root summary:active { text-decoration: underline; }
.dcl-comparison-table-category-bands-root a { display: inline-block; padding: 0.2rem; text-underline-offset: 0.2em; }
.dcl-comparison-table-category-bands-root a:hover { text-decoration-thickness: 2px; }
.dcl-comparison-table-category-bands-root fieldset { padding: 0.75rem; border: 1px solid var(--edge); border-radius: 0.5rem; }
.dcl-comparison-table-category-bands-root legend { font-weight: 700; padding-inline: 0.35rem; }
.dcl-comparison-table-category-bands-scroll { overflow-x: auto; padding: 0.2rem; }
.dcl-comparison-table-category-bands-root table { border-collapse: collapse; inline-size: 100%; text-align: start; }
.dcl-comparison-table-category-bands-root caption { text-align: start; font-weight: 700; padding-block: 0.375rem; }
.dcl-comparison-table-category-bands-root td, .dcl-comparison-table-category-bands-root th { border-block-end: 1px solid var(--edge); padding: 0.5rem; text-align: start; }
.dcl-comparison-table-category-bands-root svg { display: block; max-inline-size: 100%; block-size: auto; }
.dcl-comparison-table-category-bands-border { border-inline-start: 0.25rem solid var(--accent); padding-inline-start: 0.875rem; }
.dcl-comparison-table-category-bands-center { text-align: center; justify-items: center; }
.dcl-comparison-table-category-bands-center svg { margin-inline: auto; }
.dcl-comparison-table-category-bands-root [hidden] { display: none; }
.dcl-comparison-table-category-bands-stack[hidden], .dcl-comparison-table-category-bands-bar[hidden] { display: none; }
@media (max-width: 34rem) { .dcl-comparison-table-category-bands-rail { grid-template-columns: minmax(0, 1fr); } }
.dcl-comparison-table-category-bands-root td, .dcl-comparison-table-category-bands-root th { overflow-wrap: normal; padding-inline: 0.4rem; }
.dcl-comparison-table-category-bands-root table { min-inline-size: 25rem; }
</style>
When to use
Use when different people scan distinct subjects such as permissions and export. Repeat the same plan order in every band.
Avoid
Do not break a single short matrix into multiple tables without a meaningful category boundary.
Accessibility
The caption and scoped row and column headers keep each value associated with its feature and plan. Each category has its own visible caption. If columns do not fit, focus the named table viewport and scroll with the arrow keys. Theme token text pairs reach at least 6.2:1 in light and 6.8:1 in dark.
Was this useful? Send feedback.