Skip to main content

  • Foundations
    • Border radius
    • Breakpoints
    • Colours
    • Colour scheme
    • Elevation
    • Focus and outline
    • Sizing and spacing
    • Layout
    • Motion
    • Typography
    • Z-index
  • Elements
    • Buttons
    • Code
    • Icons
    • Figure and caption
    • Forms
    • Links
    • Lists
    • Media
    • Tables
  • Components
    • Accordion
    • Alerts
    • Avatar
    • Blockquote
    • Breadcrumbs
    • Card
    • Chiplets
    • Details and summary
    • Dialog
    • Empty state
    • Stats
    • Global footer
    • Horizontal rule
    • Kanban
    • Key-value list
    • Meter
    • Objects
    • Pagination
    • Polka background
    • Post-it note
    • Progress
    • Speech bubbles
    • Status dot
    • Skeleton
    • Skip link
    • Spinner
    • Toggles
    • Tooltip
    • Webmentions
  • Patterns
    • Article header
    • Author card
    • App list and app sheet
    • Error page
    • Related posts
    • Search results
    • Utilities

John Peart

  • Search
  • Menu
John Peart

Elevation

Shadow scale and when to lift surfaces.

Elevation is expressed with a two-step hard-offset shadow system — no blur. The shadow colour always matches --color, so it flips correctly in dark mode.

Shadow scale

None
Shallow
Deep
box-shadow: var(--shadow-shallow); /* 0px 3px 0px var(--shadow-color) */
box-shadow: var(--shadow-deep);    /* 0px 5px 0px var(--shadow-color) */

When to use which

None
Flat surfaces: body content, inline text, simple cards in the document flow.
Shallow
Resting state for interactive surfaces: buttons, chiplets, alerts.
Deep
Floating or lifted surfaces: toasts, dialogs, active/hovered cards.

Press-down pattern

On hover or press, move the element down by the shadow offset and remove the shadow — this simulates the surface being pushed into the page.

.button {
  box-shadow: var(--shadow-shallow);
  transition: top 0.15s, box-shadow 0.15s;
}
.button:hover {
  top: 3px;
  box-shadow: none;
}

Text shadow

A subtle text shadow is available for layered type over photos — --text-shadow--color inverts automatically between light and dark mode.

A line drawing of John Peart

John Peart

www.johnpe.art

Mastodon logo

Mastodon

BlueSky logo

Bluesky

LinkedIn logo

LinkedIn

Github logo

GitHub