Style

Cards can be used in light and dark themes. They act as a blank canvas where elements and styles can be placed inside.

A breakdown of the parts of a card

Theme

Card in light theme
Card in dark theme

Color

Cards are secondary layouts that shouldn’t command too much attention and blend in with whatever background they’re placed on. The card container is the only required element and it consists of a background color and rounded corners. A thin border is required if the card background is the same color as the background it's placed on.

White card colors
A white card with a light gray border is the most common use case in the light theme
Gray card colors
A light gray card without a border can also be used as an alternate option
Black card colors
A black card with a dark gray border is the most common use case in the dark theme
Dark theme gray card colors
A dark gray card without a border can also be used as an alternate option

Layout

A card features header, body, and footer sections. Those sections should include a limited amount of content to ensure that the card doesn’t become too tall.

Example of a card layout
Anatomy of a card layout

The header section is required, it introduces what the content is and shouldn’t be hidden.

Body

The body section can include a headline, text, an icon, or sometimes an image. The body section describes the content in more detail and shouldn’t be hidden.

The footer section can include normal links or a call to action. It can be hidden if necessary if there’s content included where a user can take an action.

Responsive design

Breakpoints

Cards will get thinner or move below each other on smaller screens.

Large screens

Card layout on desktop

Small screens

Card layout on mobile

Spacing

Example Token Description
16 --rh-space-lg 16px spacer
24 --rh-space-xl 24px spacer
32 --rh-space-2xl 32px spacer
48 --rh-space-3xl 48px spacer

Container padding

Container padding defines how far away content is from the edges of the component. When cards become wider, the container padding increases. When they become thinner, the container padding decreases. See more examples.

Desktop

Card spacing on desktop

Mobile

Card spacing on mobile
© 2021-2024 Red Hat, Inc. Deploys by Netlify