Skip to content

Card

Create account

Enter your details below.

<div class="card">
<div class="card-header">
<h3 class="card-title">Title</h3>
<p class="card-description">Supporting line.</p>
</div>
<div class="card-content"></div>
<div class="card-footer"></div>
</div>

Billing

Next invoice on 1 September.

Pro plan · $20 per month

ClassPart
.cardContainer
.card-headerTitle area
.card-titleHeading
.card-descriptionSupporting line
.card-actionControl pinned to the header’s trailing edge
.card-contentBody
.card-footerA bar across the bottom, with its own surface

The footer is not just a row: it takes the card’s full width, carries a top border and a muted surface, and the card drops its own bottom padding to make room. The same happens for an image at either end.

Default

Roomier spacing throughout.

Body content.

Small

One variable tightens every section.

Body content.

data-size="sm" lowers --card-spacing, and every section follows: padding, gaps and the space between header, content and footer. The title steps down a size with it.

Nothing stops you setting the variable yourself, for a card that has to match a layout the two presets do not.

Roomier

One variable moves every section at once.

Set --card-spacing to whatever the layout needs.

<div class="card" style="--card-spacing: 1.5rem">

An img as the first or last child runs edge to edge and takes the card’s corners.

Aurora

An image at the top runs to the edge.

Give a decorative image alt="" so it is skipped, and set width and height so the card does not jump when it loads.

The card is a plain container, so it takes any element — a <form> here, and the footer’s submit button posts without extra wiring.

Create account

Enter your details below.

Set dir="rtl" on the page or on any subtree — padding, corners and positions follow the reading direction on their own. See the button page for a live example.

A card is a container, not a landmark: it has no role of its own, and the heading inside it is what gives it a name in a document outline. Use a real heading level that fits the page rather than picking one for its size.

If the whole card is a link, wrap the heading in the anchor rather than the card — a link the size of a card is hard to escape with a screen reader, and it swallows any control inside it.