On this page
A border gives a card an even edge. When that card needs to feel raised, use a layered shadow. A faint ring defines the shape, and two offset shadows suggest the space underneath. Compare the bottom edges of the two cards.
Three layers
Try turning off Ring, Contact, and Ambient one at a time. The edge, the shadow just below it, and the wider falloff should change independently.
The ring uses zero offset and blur with a 1px spread, so it follows the rounded corner without taking up layout space. Contact uses a small downward offset and a tight blur. Ambient uses more offset and blur, with negative spread to keep the shadow concentrated beneath the card. Judge the strength on the surface where the card will actually sit.
Elevation
Keep the edge and contact shadow consistent across elevation levels. Add a wider falloff when a card lifts, then a longer one for a popover that sits above other content.
Dark mode
On a dark surface, a black ring loses contrast. Compare the same card with the light-mode recipe and a recipe tuned for a dark background.
A faint inset ring defines the edge, and a thin highlight across the top suggests light from above. The darker shadows underneath still help separate the card from the surfaces behind it.
Usage
Copy --shadow-card from Three layers, then apply it to your card. The snippet switches to the dark values when the root element has data-theme="dark".
.card {
border-radius: 12px;
box-shadow: var(--shadow-card);
}
Use borders for dividers and for control boundaries that need to stay visible. If a boundary is essential for recognising a control or its state, check it against WCAG’s non-text contrast guidance.