Home/Tools/Components/Card Generator
Components · Generator

Card Generator

Build modern UI cards with custom shadows, borders, and glass effects.

Card Style

24px
16px

Preview

Sample Card

This is a preview of your custom card design. The card will adapt to the settings you choose on the left.

Generated CSS & HTML
.custom-card {
  padding: 24px;
  border-radius: 16px;
  background: #ffffff;
  
  border: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.custom-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.16);
}
100%
Free, no
sign-up needed
0
Code written
by hand
85+
CSS tools
in one place
<1s
Copy-ready
CSS instantly
What is this

What is the CSS Card Generator?

Generate card component CSS with shadows, borders, hover lifts, and dark mode variants. Copy production code instantly.

Everything runs locally in your browser. Adjust the controls above, preview instantly, and copy clean, production-ready CSS — no account, no upload.

How to use

Using the CSS Card Generator

Everything lives in the panel at the top of this page. There is nothing to install — it all runs right here in your browser.

1

Set border radius and padding

Adjust the corner radius (0px to 24px) and internal padding. Common UI patterns use 12-16px radius for cards.

2

Configure the shadow

Choose shadow intensity from flat to elevated. The generator creates two-layer box-shadow values that read as natural depth.

3

Toggle hover lift

Enable the hover lift effect to add a translateY(-2px) and heavier shadow on :hover. Disable for non-interactive cards.

4

Copy the CSS

Click Copy to get the card CSS with base, hover, and optional dark mode styles.

The output

What the generated code looks like

Clean, production-ready CSS — no vendor bloat, no unnecessary declarations.

card.css
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}

Two-layer shadows (ambient + directional) look more natural than a single box-shadow. The outer layer simulates ambient light; the inner layer simulates a key light source.

Common mistakes & fixes

Common mistakes & how to fix them

A few habits trip people up. Here is what to watch for — and the exact fix.

Single-value box-shadow looks flat

box-shadow: 0 4px 8px rgba(0,0,0,0.1) has one hard edge and looks unnatural.

Fix: Use two layers: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06). The ambient layer (smaller spread, lower opacity) makes the shadow look real.

Hover lift without will-change causes layout reflow

translateY(-2px) on :hover triggers layout recalculation in some browsers.

Fix: Add will-change: transform to the card base style to promote it to a composited layer.

Pro tips

Pro tips for better results

Use border + shadow together, not shadow alone

On white backgrounds, a 1px solid #e5e7eb border defines the card edge without relying entirely on shadow. This keeps cards readable in bright ambient light (mobile outdoors).

Match shadow colour to your brand hue

Replace the black channel in rgba(0,0,0,0.08) with your brand colour: rgba(0,113,227,0.08) creates a coloured shadow that reinforces brand identity subtly.

FAQ

Frequently asked questions

Apply display: grid or display: flex to the card container. Grid children stretch to the tallest item by default with align-items: stretch.
Both work. Direct padding is simpler. A child .card-body div is useful when you want a card image that bleeds to the edges above the padded content area.

From the blog

Read more