Base elements
Native HTML elements styled by the base layer, with no classes.
Live example
Text
<h1>Heading level 1</h1>
<h2>Heading level 2</h2>
<h3>Heading level 3</h3>
<h4>Heading level 4</h4>
<h5>Heading level 5</h5>
<h6>Heading level 6</h6>
<p>
A paragraph with a <a href="#text-title">link to this section</a>, some <strong>strong importance</strong>,
<em>stress emphasis</em>, a <mark>highlighted run</mark>, an abbreviation like
<abbr title="Web Content Accessibility Guidelines">WCAG</abbr>, inline <code><code></code>,
sample output <samp>Saved.</samp>, and keyboard input <kbd>Ctrl</kbd> + <kbd>K</kbd>.
Prose is capped at a comfortable measure so lines stay readable on wide screens.
</p>
<p><small>Small print: side comments such as legal text use <code><small></code>.</small></p>
<p>H<sub>2</sub>O and E = mc<sup>2</sup> keep their line height.</p>
<hr>
<blockquote cite="https://www.w3.org/TR/using-aria/#rule1">
<p>If you can use a native HTML element or attribute with the semantics and behavior you require already built in, instead of re-purposing an element and adding an ARIA role, state or property to make it accessible, then do so.</p>
<footer>From <cite><a href="https://www.w3.org/TR/using-aria/#rule1">Using ARIA, first rule</a></cite></footer>
</blockquote>
Rendered Markdown
<div data-prose>
<p>Markdown from a framework or a CMS often arrives inside a wrapper element.</p>
<p><code>data-prose</code> on that wrapper spaces its paragraphs, lists and headings like an article.</p>
<ul>
<li>Astro's <code><Content /></code></li>
<li>MDX and CMS rich text</li>
</ul>
</div>
Lists
<div class="grid">
<div>
<h3>Unordered</h3>
<ul>
<li>Native elements first</li>
<li>Tokens as custom properties
<ul>
<li>Primitive</li>
<li>Semantic</li>
</ul>
</li>
<li>Cascade layers</li>
</ul>
</div>
<div>
<h3>Ordered</h3>
<ol>
<li>Link the stylesheet</li>
<li>Write semantic HTML</li>
<li>Override tokens to theme</li>
</ol>
</div>
<div>
<h3>Description</h3>
<dl>
<dt>Primitive token</dt>
<dd>A raw value, named by what it is.</dd>
<dt>Semantic token</dt>
<dd>A role, pointing at a primitive.</dd>
</dl>
</div>
</div>
Preformatted code
<pre><code><link rel="stylesheet" href="css/domestic.css">
:root {
--dui-color-accent: light-dark(#7a2e8c, #e2a8f0);
--dui-font-heading: charter, "Bitstream Charter", "Sitka Text", cambria, serif;
}</code></pre>
<pre data-scroll="inline" tabindex="0" aria-label="Copy the CSS into a project"><code>git clone --depth 1 https://github.com/odonckers/domestic-ui.git && cp -R domestic-ui/css public/css && rm -rf domestic-ui</code></pre>
Media
<div class="grid">
<figure>
<svg role="img" aria-labelledby="svg-title" viewBox="0 0 160 90" width="320" height="180">
<title id="svg-title">Three stacked layers: reset, tokens, base</title>
<rect x="20" y="58" width="120" height="20" rx="4" fill="none" stroke="currentColor" stroke-width="2"/>
<rect x="30" y="35" width="100" height="20" rx="4" fill="none" stroke="currentColor" stroke-width="2"/>
<rect x="40" y="12" width="80" height="20" rx="4" fill="currentColor"/>
</svg>
<figcaption>An inline <code><svg></code> drawn with <code>currentColor</code>.</figcaption>
</figure>
<figure>
<picture>
<source type="image/svg+xml" srcset="data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20320%20180'%3E%3Crect%20width='320'%20height='180'%20fill='%233451d1'/%3E%3Ccircle%20cx='250'%20cy='60'%20r='28'%20fill='%23fff1a8'/%3E%3Cpath%20d='M0%20180%20L110%2070%20L190%20150%20L240%20110%20L320%20180%20Z'%20fill='%2312151b'/%3E%3C/svg%3E">
<img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 180'%3E%3Crect width='320' height='180' fill='%233451d1'/%3E%3C/svg%3E" alt="A flat illustration of dark mountains under a pale sun on a blue sky." width="320" height="180">
</picture>
<figcaption>A <code><picture></code> with an <code><img></code> fallback and alt text.</figcaption>
</figure>
<figure>
<video controls preload="none" width="320" height="180" aria-describedby="video-caption" poster="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 180'%3E%3Crect width='320' height='180' fill='%23252a34'/%3E%3Cpath d='M140 65 L190 90 L140 115 Z' fill='%23f6f7f9'/%3E%3C/svg%3E">
<track kind="captions" src="data:text/vtt,WEBVTT" srclang="en" label="English" default>
Your browser does not support the video element.
</video>
<figcaption id="video-caption">A <code><video></code> with controls and a captions track (no source loaded, so no network requests).</figcaption>
</figure>
</div>
Tables
<section data-scroll="inline" aria-labelledby="contrast-caption" tabindex="0">
<table>
<caption id="contrast-caption">Contrast minimums in WCAG 2.2 AA</caption>
<thead>
<tr>
<th scope="col">Content</th>
<th scope="col">Success criterion</th>
<th scope="col">Minimum ratio</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Body text</th>
<td>1.4.3 Contrast (Minimum)</td>
<td>4.5:1</td>
</tr>
<tr>
<th scope="row">Large text</th>
<td>1.4.3 Contrast (Minimum)</td>
<td>3:1</td>
</tr>
<tr>
<th scope="row">Control boundaries</th>
<td>1.4.11 Non-text Contrast</td>
<td>3:1</td>
</tr>
<tr>
<th scope="row">Focus indicator</th>
<td>1.4.11 Non-text Contrast</td>
<td>3:1</td>
</tr>
</tbody>
<tfoot>
<tr>
<th scope="row">Source</th>
<td colspan="2"><a href="https://www.w3.org/TR/WCAG22/">WCAG 2.2</a></td>
</tr>
</tfoot>
</table>
</section>
Attributes
None: write semantic HTML.
data-color-scheme="light" | "dark"data-surface="inverse"data-prose on that wrapper gives its children the same rhythm.
| File | Covers |
|---|---|
css/base/document.css | Document, color scheme, rhythm and focus. |
css/base/forms.css | – |
css/base/interactive.css | – |
css/base/media.css | – |
css/base/tables.css | – |
css/base/typography.css | – |
Accessibility
- Links keep their underline, so color is never the only cue (WCAG 1.4.1).
- Every focusable element shows a
:focus-visibleoutline in--dui-color-focus, the systemhighlightcolor in forced colors (WCAG 2.4.7). scroll-padding-blockkeeps focused elements clear of sticky edges (WCAG 2.4.11).- Text controls, buttons and summaries are at least
--dui-size-targettall (WCAG 2.5.8). - Checkboxes, radios and range keep native rendering, tinted with
accent-color. - Open a
<dialog>withshowModal()orcommand="show-modal"so the browser handles focus, Esc and inertness (APG Dialog (Modal)). - Duration tokens are
0sunderprefers-reduced-motion: reduce. - CSS cannot add semantics: label every control, group with
<fieldset>and<legend>, give tables a<caption>andth scope, and imagesalt(Accessibility baseline).
Specifications
- MDN
color-scheme - MDN
light-dark - A List Apart axiomatic css and lobotomized owls
- MDN
:focus-visible - W3C the focus visible pseudo
- MDN View Transition API
- MDN
forced-colors - WHATWG forms
- W3C labels
- MDN
:user-invalid - MDN
accent-color - MDN
appearance - ui.shadcn.com checkbox
- ui.shadcn.com label
- MDN
forced-colors - WHATWG interactive elements
- MDN
dialog - APG dialog modal
- APG disclosure
- WHATWG embedded content
- WHATWG tables
- W3C tables
- ui.shadcn.com table
- WHATWG text level semantics
- WCAG Use of color
- MDN
overflow-wrap - MDN
:visited - MDN browser compatibility
- W3C forced colors properties
- W3C important
- W3C corner shaping
- WHATWG the code element
- WCAG Reflow
- MDN
white-space - Deque University scrollable region focusable
- WCAG Keyboard
- MDN CSS Custom Highlight API
- W3C css highlight api 1
- MDN
forced-color-adjust
See also
How other systems do it
For comparison only; these are not the standard this system follows.
- Apple Human Interface Guidelines: No equivalent
- Material Design 3: No equivalent
- Vercel Geist: No equivalent