Richard Groß

IT Archaeology: Mend Software · Create Options · Increase ROI

RSS

Home

Made with modern web features

This site intentionally uses modern web platform features to showcase them, and because I trust my audience to use auto-updating browsers.

Baseline describes web platform features that work across the core browser set. For this page, any Baseline browser released after should support every feature listed here.

Container style queries

Baseline since:

Fallback: Author-provided — Unsupported browsers ignore the query block, so the default styles must be authored as the fallback. See also.

Example

Viewport tokens such as --viewport: tablet and --viewport: narrow are queried by layout and card styles.

:root {
  --viewport: desktop;

  @media (max-width: 900px) {
    --viewport: tablet;
  }
}

@container style(--viewport: tablet) {
  .box {
    width: var(--width-panel-tablet);
  }
}
Custom highlights

Baseline since:

Fallback: Progressive enhancement — Code remains readable if CSS.highlights or ::highlight() is ignored; only syntax coloring is lost.

Example

MicroLighter registers syntax-token ranges with the CSS Custom Highlight API and the site themes those highlight names without wrapping source code in extra spans.

::highlight(keyword) {
  color: var(--color-syntax-highlighting-keyword);
}

::highlight(string) {
  color: var(--color-syntax-highlighting-string);
}
Invoker commands

Baseline since:

Fallback: Polyfillable — Unsupported browsers ignore command and commandfor. The invokers polyfill adds support for command attributes and command events; the site's dialog component also supplies a fallback for its native dialog commands. See also.

Example

Dialog cancel buttons use command and commandfor to close their target dialog declaratively, without a dedicated click handler in supporting browsers.

<button type="button" command="close" commandfor="example-dialog">Cancel</button>
<dialog id="example-dialog">
  <p>Dialog content</p>
</dialog>

Example

List-sorter buttons dispatch a custom command to their target component. Data attributes on the button supply application-specific parameters, accessible through the command event's source element.

<button type="button" command="--sort" commandfor="example-sorter"
        data-sort="name" data-order="asc">Title</button>
<list-sorter id="example-sorter"></list-sorter>

Example

The command event identifies the invoking button through event.source. Its data attributes carry the parameters; they are not copied into an event.detail payload.

const sorter = document.querySelector("#example-sorter");
sorter.addEventListener("command", (event) => {
  if (event.command !== "--sort") return;
  const { sort, order } = event.source.dataset;
  console.log(sort, order); // "name", "asc"
});
Popover

Baseline since:

Fallback: Polyfillable — Unsupported browsers need JavaScript to emulate show, hide, focus, and backdrop behavior; otherwise popover content may appear inline. See also.

Example

Collection counters expose their detail panel as a native popover so it can enter the top layer and light-dismiss.

<button type="button" command="toggle-popover" commandfor="collection-stats-talks">
  Show counted talks
</button>
<div id="collection-stats-talks" popover>
  <h2>Talks</h2>
  <p>42 counted talks.</p>
</div>
light-dark()

Baseline since:

Fallback: Author-provided — Unsupported browsers drop declarations using the unknown color function, so fallback color declarations are needed. See also.

Example

Design tokens select light and dark theme values directly in CSS.

:root {
  color-scheme: light dark;
  --color-background: light-dark(#ffffff, #111111);
  --color-text: light-dark(#555555, #f1f3f5);
}
text-wrap: balance

Baseline since:

Fallback: Progressive enhancement — Unsupported browsers ignore the declaration and fall back to default text wrapping. See also.

Example

Home-page headings use balanced wrapping to avoid awkward short final lines.

.home-hero h1 {
  text-wrap: balance;
}
AVIF

Baseline since:

Fallback: Author-provided — Browsers without AVIF support need an alternative image format supplied with a picture element. The site serves the profile image directly as AVIF, so unsupported browsers display its alt text instead. See also.

Example

The header uses an AVIF profile image to reduce the image download size.

<img src="/assets/img/profile.avif" class="avatar-img" alt="avatar">
:has()

Baseline since:

Fallback: Author-provided — Our usage only improves code-block styling; the base code styles are authored as the fallback for unsupported browsers. See also.

Example

Code-block styling targets pre elements that contain language-marked code.

pre:has(> code[class*="language-"]) {
  background-color: var(--color-code-background);
  overflow: auto;
}
Lazy-loading images and iframes

Baseline since:

Fallback: Progressive enhancement — Unsupported browsers ignore the loading attribute and load images eagerly instead. See also.

Example

Profile and conference logo images use native lazy loading. Specify width and height to reserve space before images load, preventing layout shifts and helping the browser determine when to load them. Without dimensions or equivalent CSS sizing, unloaded images can occupy no space and may not load as expected. These attributes are not required by HTML, but are important for reliable lazy loading.

<img src="/assets/img/conferences/build-stuff-26.avif"
     alt="Build Stuff" loading="lazy" width="352" height="187">
CSS nesting

Baseline since:

Fallback: Build-time transform — Build tools can flatten nested CSS to equivalent unnested rules. See also.

Example

Viewport token media queries are nested inside :root, keeping token defaults and overrides together.

:root {
  --viewport: desktop;

  @media (max-width: 900px) {
    --viewport: tablet;
  }
}
Import maps

Baseline since:

Fallback: Polyfillable — Browsers without import maps need a loader or build step that rewrites bare module specifiers to URLs. See also.

Example

The site maps bare module specifiers to generated asset URLs, then imports those modules by name.

<script type="importmap">
  {
    "imports": {
      "microlighter": "/assets/vendor/microlighter/microlighter.js",
      "scroll-to-top-element": "/assets/elements/ScrollToTopElement.mjs",
      "secret-email-button-element": "/assets/elements/SecretEmailButtonElement.mjs"
    }
  }
</script>

<script type="module">
  import "microlighter";
  import "scroll-to-top-element";
  import "secret-email-button-element";
</script>
Small, large, and dynamic viewport units

Baseline since:

Fallback: Author-provided — Unsupported browsers drop dvw and dvh declarations unless separate viewport-unit fallbacks are authored.

Example

Popovers are capped against the dynamic viewport so they fit mobile browser UI changes.

.collection-stats-popover {
  max-width: min(34rem, calc(100dvw - 2rem));
  max-height: min(28rem, calc(100dvh - 2rem));
}
Cascade layers

Baseline since:

Fallback: Build-time transform — A build step can order and flatten layers for older browsers. Without that transform, unsupported browsers ignore layered rules. See also.

Example

The CSS bundle is organized into theme, base, layout, block, page, and utility layers.

@layer argh.theme, argh.base, argh.layout, argh.blocks, argh.pages, argh.utilities;

@layer argh.blocks {
  .nav-item {
    display: flex;
  }
}
color-scheme

Baseline since:

Fallback: Progressive enhancement — Unsupported browsers keep their default control and browser chrome colors. See also.

Example

The document advertises support for light and dark form controls and browser chrome.

<meta name="color-scheme" content="light dark">

Example

CSS also opts the page into both schemes for built-in controls and system colors.

:root {
  color-scheme: light dark;
}
Logical properties

Baseline since:

Fallback: Author-provided — Unsupported browsers drop logical declarations, so physical-property fallbacks are needed where the spacing or sizing is essential. See also.

Example

Home-page sections use block-axis padding and borders so spacing follows the document writing mode.

.home-section {
  padding-block: var(--space-2xl);
  border-block: var(--border-width) solid var(--color-border);
}
@supports selector()

Baseline since:

Fallback: Progressive enhancement — Browsers without selector feature queries skip the conditional styles; base styles remain in effect.

Example

The selector() condition tests support for selector syntax, such as :has(), rather than a CSS property and value.

@supports selector(:has(*)) {
  pre:has(> code[class*="language-"]) {
    background-color: var(--color-code-background);
  }
}
Autonomous custom elements

Baseline since:

Fallback: Polyfillable — Unsupported browsers can use a JavaScript polyfill; without it, these custom elements wrap ordinary HTML and the page remains usable when they are not upgraded. See also.

Example

The scroll-to-top control is a <scroll-to-top> custom element.

<scroll-to-top></scroll-to-top>

<script type="module">
  class ScrollToTop extends HTMLElement {
    connectedCallback() {
      this.innerHTML = `<button type="button">Top</button>`;
    }
  }

  customElements.define("scroll-to-top", ScrollToTop);
</script>
@supports

Baseline since:

Fallback: Progressive enhancement — Unsupported browsers ignore the entire block, so essential fallback styles must be declared outside it. See also.

Example

Feature queries allow a basic warning style to work independently of newer CSS, with enhancements applied only when their property and value are supported.

.browser-support-warning {
  background: #fff3cd;
  color: #332701;
}

@supports (color: light-dark(black, white)) {
  .browser-support-warning {
    background: light-dark(#fff3cd, #332701);
    color: light-dark(#332701, #fff3cd);
  }
}