Service Status Table in HTML, CSS and vanilla JS
A copy-paste Service Status Table in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="example-service-status-table" data-dcl-layout="stack" data-dcl-scheme="light" aria-labelledby="example-service-status-table-title"><header><h2 id="example-service-status-table-title">Service Status Table</h2></header><div class="parts"><table><caption>Example data</caption><thead><tr><th scope="col">Item</th><th scope="col">Details</th></tr></thead><tbody><tr><th scope="row">Directory</th><td>Available in all regions.</td></tr><tr><th scope="row">Search</th><td>Degraded in the west region.</td></tr><tr><th scope="row">Billing</th><td>Scheduled maintenance on Monday.</td></tr></tbody></table></div>
<script>
(() => {
const root = document.currentScript.closest(".example-service-status-table");
const instance = Array.from(document.getElementsByClassName("example-service-status-table")).indexOf(root);
if (instance > 0) {
const references = ["id", "aria-labelledby", "aria-controls", "aria-describedby", "for", "name"];
for (const element of [root, ...root.querySelectorAll("*")]) {
for (const attr of references) {
if (element.hasAttribute(attr)) element.setAttribute(attr, element.getAttribute(attr) + "--" + instance);
}
const href = element.getAttribute("href");
if (href && href.startsWith("#")) element.setAttribute("href", href + "--" + instance);
}
}
const preference = matchMedia("(prefers-color-scheme: dark)");
const apply = () => { root.dataset.dclScheme = preference.matches ? "dark" : "light"; };
preference.addEventListener("change", apply);
apply();
})();
</script></section>
<style>
.example-service-status-table { color: #11292f; background-color: #ffffff; color-scheme: light; }
.example-service-status-table a { color: #005c62; }
.example-service-status-table button, .example-service-status-table summary, .example-service-status-table input, .example-service-status-table select {
color: #11292f; background-color: #e4edef; border-color: #697f84;
}
.example-service-status-table button:hover, .example-service-status-table summary:hover, .example-service-status-table button[aria-selected="true"] {
color: #ffffff; background-color: #00535a;
}
.example-service-status-table dialog { color: #11292f; background-color: #ffffff; }
.example-service-status-table [data-note] { color: #11292f; background-color: #e4edef; }
.example-service-status-table :focus-visible { outline: 3px solid #005c62; outline-offset: 2px; }
.example-service-status-table[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; color-scheme: dark; }
.example-service-status-table[data-dcl-scheme="dark"] a { color: #8fe1da; }
.example-service-status-table[data-dcl-scheme="dark"] button, .example-service-status-table[data-dcl-scheme="dark"] summary, .example-service-status-table[data-dcl-scheme="dark"] input, .example-service-status-table[data-dcl-scheme="dark"] select {
color: #eff8f9; background-color: #1c3c44; border-color: #839fa5;
}
.example-service-status-table[data-dcl-scheme="dark"] button:hover, .example-service-status-table[data-dcl-scheme="dark"] summary:hover, .example-service-status-table[data-dcl-scheme="dark"] button[aria-selected="true"] {
color: #11292f; background-color: #8fe1da;
}
.example-service-status-table[data-dcl-scheme="dark"] dialog { color: #eff8f9; background-color: #142f36; }
.example-service-status-table[data-dcl-scheme="dark"] [data-note] { color: #eff8f9; background-color: #1c3c44; }
.example-service-status-table[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 2px; }
.example-service-status-table, .example-service-status-table * { box-sizing: border-box; }
.example-service-status-table { font: 1rem/1.5 system-ui, sans-serif; padding: 1rem; border-radius: 0.75rem; overflow-wrap: anywhere; }
.example-service-status-table h2, .example-service-status-table h3 { line-height: 1.15; margin-block: 0 0.75rem; }
.example-service-status-table p { margin-block: 0.5rem; }
.example-service-status-table ul { margin-block: 0.5rem; padding-inline-start: 1.5rem; }
.example-service-status-table article, .example-service-status-table details, .example-service-status-table [data-note] { border: 1px solid; border-radius: 0.375rem; padding: 0.75rem; }
.example-service-status-table button, .example-service-status-table summary, .example-service-status-table input, .example-service-status-table select {
min-block-size: 44px; border: 1px solid; border-radius: 0.375rem; padding: 0.5rem 0.75rem; font: inherit;
}
.example-service-status-table button, .example-service-status-table summary { cursor: pointer; transition: background-color 140ms ease-out; }
.example-service-status-table button:disabled { cursor: not-allowed; text-decoration: line-through; }
.example-service-status-table input { display: block; inline-size: 100%; }
.example-service-status-table dialog { max-inline-size: min(32rem, 90vw); border-radius: 0.75rem; padding: 1rem; }
.example-service-status-table th, .example-service-status-table td { padding: 0.5rem; text-align: start; border-block-end: 1px solid; }
.example-service-status-table table { border-collapse: collapse; inline-size: 100%; }
.example-service-status-table caption { font-weight: bold; text-align: start; }
.example-service-status-table dt { font-weight: 600; }
.example-service-status-table dd { margin: 0 0 0.75rem; }
.example-service-status-table [hidden] { display: none !important; }
.example-service-status-table .parts { display: grid; gap: 1rem; }
@media (max-width: 30rem) {
.example-service-status-table[data-dcl-layout="rail"] .parts { grid-template-columns: minmax(0, 1fr); }
.example-service-status-table[data-dcl-layout="rail"] .parts > :is(p, ul, article) { grid-column: 1; grid-row: auto; }
.example-service-status-table[data-dcl-layout="rail"] .parts > :is(details, nav) { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) { .example-service-status-table * { transition: none !important; } }
</style>
When to use
Use this stacked pattern to give each item a full-width row.
Avoid
Choose a list when there is no row or column relationship to compare.
Accessibility
Keep a caption and scoped header cells so screen readers can announce relationships.
Was this useful? Send feedback.