Art Direction Daily
CSS, style queries

Let the sidebar decide how every card inside it looks

Container style queries are Baseline Newly Available, and Kevin Powell makes the case for using them as modifiers that live on the parent: set one custom property on a sidebar or a section, and every card under it changes layout.

A browser window showing the same pricing card component three ways: compact rows in a sidebar that sets card density to compact, full cards in the main column with no property set, and a split row whose grid turns on its side.
Live captureOne card component, three parents. The page was built with real style queries and captured in Chromium; nothing on a card changed between the columns except the ancestor it sits in.
Group 01Lead, technique

Modifiers that the parent sets, not the card

In a new CSS-Tricks piece, Kevin Powell separates two kinds of variant. A component variant, like an accent button or a pill shape, belongs on the element as a class. A layout variant usually depends on where the component sits, and that is where a style query fits: the parent sets a custom property and the card reads it with @container style().

His examples are the kind that pile up in real projects. A sidebar sets a card density of compact and every card inside shrinks to a row. A split layout sets an overflow grid direction of row, and the grid inside flips its flow. A data attribute on a wrapper can still be the switch; it just sets the property and lets the cards respond.

The card stops carrying its own modifier, and the section it lands in starts giving the orders.

He is clear that this is an addition, not a replacement. Modifier classes and data attributes still suit variants that belong to the component itself, and style queries only take custom properties for now.

Card density This switch sets one custom property on the wrapper and each card answers it with a style query. Without style query support the cards stay comfortable.

Modifier class

Lives in
The class list
.card--compact { … }
  • Works in every browser
  • Easy to read in the markup
  • The parent cannot ask for it
  • A media query cannot switch it

Fits: an accent button, a pill shape.

Data attribute

Lives in
An attribute
.toast[data-type="error"] { … }
  • Works in every browser
  • One attribute, several values
  • Still written on every instance
  • A media query cannot switch it

Fits: states like error, success, warning.

The three modifiers, compared
QuestionModifier classData attributeStyle query
Where is it set?On the cardOn the card or a wrapperOn any ancestor, as a custom property
Can a media query switch it?NoNoYes, by setting the property
Can the element read its own value?YesYesNo, it reads an ancestor
What can it test?The class nameThe attribute valueCustom property values; regular properties are specced but unsupported
SupportEverywhereEverywhereBaseline Newly Available
Group 02Today's art direction

Today's art direction

The Modifier Pricing Page

A SaaS plan-compare page where the plans are three ways to write a variant.

A pricing page is the most borrowed layout on the web, so it carries the comparison: a buy-box holds the issue details where the order summary would be, three plan cards line up the options, and the featured plan wears the cobalt. The billing toggle is real and runs on the feature it sells. Archivo at its widest does the shouting; Libre Caslon reads the fine print.

  • buy-box masthead
  • plan cards
  • featured tier
  • billing toggle
  • compare table
  • FAQ accordion
  • scallop ground
  • Pea green#A8D84E ground
  • Forest ink#13200F text, rules
  • Receipt white#F7F8EF cards
  • Plan cobalt#2440C8 featured, buttons
  • Moss#4D5E1E labels
Group 03Technique

A grid that turns on its side when its parent asks

Powell's overflow grid is the cleanest pattern in the piece. The grid reads its flow from a custom property with a fallback, and a parent that needs rows sets the property once. The grid can also hold a style query on the same property for anything the flow alone does not change.

.overflow-grid {
  display: grid;
  grid-auto-flow: var(--overflow-grid-direction, column);
}
.split {
  --overflow-grid-direction: row;
}
.card {
  @container style(--card-layout: alternative) {
    /* the alternative layout */
  }
}
Do I need container-type for this?

No. Size queries need it, but every element is already a style container, so a style query works with no setup.

Can a card set the property and query it?

No. A style query looks at an ancestor. Setting the property on the card and querying it inside the card's own rule does nothing.

Can I query display or other normal properties?

The spec allows it, but no browser supports it yet. Custom properties are the only thing you can test today.

The same capture at phone width: a media query sets card density to compact on the main column, so both full cards become compact rows.
At phone width a media query sets the density on the main column, and the full cards fall into compact rows with no new class.
Group 04Workflow

Getting drag past 60 frames a second in iPhone Safari

Rida F'kih's write-up on ProMotion iPhones starts from a known limit: unless a developer setting is switched on, Safari holds requestAnimationFrame to 60 Hz on a 120 Hz screen, and pointer events follow it. The workaround lays an invisible scroll container over the interactive area, reads its position in a loop locked to the display, and draws through an OffscreenCanvas so frames do not wait on the main thread.

Filmed at 240 frames a second over a three second drag on an iPhone 18 Pro, the scroll controller averaged 118 FPS against a steady 60 for pointer events. It is a lot of machinery for a drag handle, and F'kih says he would rather Apple support ProMotion directly, but for a slider or a canvas tool that has to feel native it is the clearest map yet.

Group 05Tooling

Vercel gives agents and people one board to claim work from

Vercel Board, released as experimental on 18 November, is a headless message store where agents and humans claim tasks, post updates and record results in channels and threads. It ships as a CLI and a JavaScript SDK, with watchers that wake an agent when something happens, scheduled follow-ups, and two-way sync with Slack and GitHub.

There is no design surface here, but it is the plumbing behind a design review that an agent can pick up on its own, and the structured schemas mean a handoff can carry the fields a reviewer actually checks.

Group 06Design move

Borrow this pattern: let the section set the density

Give a card component a small set of named densities and have it read them from a custom property on its parent. A sidebar, a pricing wrapper or a phone media query sets compact once; the cards do the rest. Keep the honest parts:

  1. Write the comfortable layout as the default, so browsers without style queries still get a complete card.
  2. Name the property after the decision, like card density, not after a look like small or blue.
  3. Set it on a parent. The card can never answer a value it set on itself.
  4. Keep true component variants, an accent button or a pill, as classes on the element.
/* the switch on this page */
.plans-wrap:has(#dz-k:checked) {
  --plan-density: compact;
}

/* a sidebar or a phone does the same */
.sidebar { --plan-density: compact; }
@media (width < 40em) {
  main { --plan-density: compact; }
}

/* the card answers */
@container style(--plan-density: compact) {
  .plan { padding: 16px 18px; }
  .plan pre, .plan ul { display: none; }
}
Group 07Prompt Lab

Build a plan-compare page whose cards answer their section

pricing-page.prompt

Paste it as one message into Beaver Builder AI, Claude, v0, Lovable or Framer.

Build a SaaS pricing and plan-compare landing page as one responsive HTML file with inline CSS.

Structure, top to bottom:
1. Top bar: wordmark left, three text links right.
2. Hero, two columns: left has a small solid dark kicker label, a wide extra-bold headline under 16 words, a two-sentence deck and a cobalt button with a 4px hard dark offset shadow plus a text link. Right is a 380px buy-box card: a small label, a huge plan or product number, a ruled list of four label and value rows (mono labels left, bold values right), and a full-width button.
3. A full-width product capture image in a 14px radius frame with a solid label chip and a one-line caption under it.
4. A density switch above the plans: a dark segmented control with two real radio inputs (Comfortable, Compact) and a one-line note.
5. Three plan cards in a row. Each: plan name, a small mono "Set on" label, a large wide-display value in place of a price, a dark code chip, a checklist with tick and cross rows, and a "Fits:" line. The third card is featured: cobalt fill, white text, an 8px hard dark offset shadow and a pea-green flag label.
6. A compare table in a cream card: caption row, mono header row, the featured column tinted pale cobalt. On phones each row becomes a stacked card with mono labels from data-l attributes.
7. A cream sheet of content rows: 680px prose column beside a ruled facts aside; one row includes an FAQ built from native details and summary elements with a plus that rotates.
8. A dark forest-ink split card: prose with numbered rules on the left, a code panel on the right.
9. Footer: two columns of note and sources under a 2px rule, then previous and next tiles.

The signature move, implemented for real: the switch sets a custom property on the wrapper with .wrap:has(#compact:checked) { --plan-density: compact; } and every plan card answers it with @container style(--plan-density: compact) { ... } to hide the code chip and checklist and tighten padding. Write the comfortable layout as the default so browsers without style queries still show full cards. Also set the same property in a phone media query.

Palette: pea green ground #A8D84E with a fish-scale scallop SVG tile in ink at about 7 percent opacity; forest ink #13200F for text, borders and rules; receipt white #F7F8EF cards; plan cobalt #2440C8 for the featured card and buttons; moss #4D5E1E for small mono labels on cream only.
Type: Archivo at width 125 and weight 800 for display, Archivo 600 for UI labels, Libre Caslon Text for body and italics, JetBrains Mono 500 for labels and code.

Guardrails: body text 19px with line-height 1.7 and lines near 65 characters; small text meets WCAG AA on its actual background; card radius 14px, inputs 8px, nothing pill-shaped; 2px ink borders instead of soft shadows, only the featured card and buy-box get a hard offset; no gradients, glow or neon; no fake logos or trusted-by bar; no fake readable text inside images; hover and focus states at 150ms with a prefers-reduced-motion guard; no horizontal scroll from 320px to 1280px.

Field note

A design system usually documents the props a component accepts; the properties its parent can set belong in the same table now.

Sources

  1. CSS style queries as conditional modifiers, Kevin Powell, CSS-Tricks
  2. CSS container style queries, Can I use
  3. Bypassing the iOS Safari 60 FPS limit, Rida F'kih
  4. Introducing Vercel Board, Vercel