Web and CSS guides

Build and Test a Responsive CSS Card

·

Use a web card to group a heading, a description and supporting information. Set a maximum card width and check whether its content wraps at smaller widths.

Card Design Generator

Set the card width and text spacing

Choose Gradient feature. Enter 380 for Card width with px as the Width unit. Set Top, Right, Bottom and Left padding to 16, 22, 18 and 26 px. Open Content and set the heading to Letterpress notes.

Switch Preview width to Narrow (224 px). Inspect how the heading and paragraph wrap. The exported card uses min(100%, 380px) for its width, so its final size depends on the parent container.

Set the card width and text spacing
Parent content widthExpected card width
520 px380 px
280 px280 px

CSS Values and Units Level 4 comparison functionsHTML Standard article element

Reopen the HTML and test its hover effect

In Design, keep Lift as the hover effect. In Content, choose Top for Media placeholder and set its height to 72 px. Download the Standalone HTML and open it in a desktop browser. Hover over the card to see it lift 4 px.

Turn on reduced motion in your browser or operating system. The card now stays in place when you hover. The top placeholder still draws its gradient. Choose Background to blend an accent tint behind the text instead.

CSS Backgrounds and Borders Level 3Media Queries Level 5 reduced motion

Common questions

Does the card include a heading element?

Yes. A filled Heading produces an h2 inside an article. Adjust the heading level after copying it if your page needs a different level.

Where does the padding apply?

It applies inside the text area, beneath a top media placeholder if selected.

Sources

Put it into practice.

Related guides