Card components are the most common repeated UI pattern in web interfaces, and the visual weight of their border determines whether the card feels lightweight and modern or heavy and dated.
Loading Border Builder…
Adjust border, border-radius, and box-shadow together in one preview
Compare flat border, shadow-only, and hybrid card styles
Preview subtle and prominent border variants side by side
Generates complete card border CSS declarations
Drop the Border Builder into any page — blog post, product docs, intranet, school portal — with a single line of HTML. Your visitors get the full tool, processed entirely in their browser. No backend, no uploads, no signup.
Embed code
<iframe
src="https://www.fixtools.io/css-tool/border-builder?embed=1"
width="100%"
height="780"
frameborder="0"
style="border:0;border-radius:16px;max-width:900px;"
title="Border Builder by FixTools"
loading="lazy"
allow="clipboard-write"
></iframe>Attribution-friendly: a small "Powered by FixTools" link appears in the embed footer.
Flat bordered cards use a visible border without a box-shadow. A typical flat card has border: 1px solid #e5e7eb with border-radius: 8px. The border defines the card boundary clearly and works well on white or very light gray backgrounds where shadow would be barely visible anyway. Flat cards are lighter in rendering cost and create a clean, structured appearance common in data tables, settings panels, and list views. The main risk is that a very light border color like #f3f4f6 can disappear on slightly off-white page backgrounds, so the border color should be tested against the actual page background color, not just the preview white.
Shadow-only cards use box-shadow without any border. A common value is box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06), which creates a close small shadow and a slightly larger ambient shadow at lower opacity. Shadow-only cards feel more elevated and three-dimensional than flat bordered cards. They work best on light gray page backgrounds where the shadow is visible. On white or very dark backgrounds, shadows lose contrast and the card boundary becomes hard to see. Adding a very subtle 1px border at rgba(0,0,0,0.05) to shadow cards helps define edges on white backgrounds.
Hybrid cards combine a light border with a shadow. The pattern border: 1px solid #e5e7eb with box-shadow: 0 2px 8px rgba(0,0,0,0.08) and border-radius: 8px is used in many modern design systems including Stripe, Linear, and Notion. The border defines the sharp edge precisely while the shadow adds depth and lift. On hover, a common interaction is to increase the shadow: box-shadow: 0 4px 16px rgba(0,0,0,0.12). This creates clear hover feedback without changing the border or border-radius, so the layout remains stable. The hybrid approach tolerates more background variety than shadow-only because the border anchors the card edge even when shadow contrast is low.
Cards are where the layered relationship between border, border-radius, and box-shadow becomes most visible, and the layering needs deliberate thought about which property carries which job. Border-radius applies to every paint layer at once, so a single radius value rounds the border, the background, and the box-shadow simultaneously without extra configuration. This is normally what you want: a rounded card with a rounded shadow looks correct. The trap appears when an interactive card animates its shape on hover. Animating border-radius itself can cause visible corner clipping artifacts during the transition because the browser has to recompute the rounded mask on every frame. The safer pattern is to keep border-radius constant and animate box-shadow spread or offset instead. The shape stays stable; the elevation suggestion changes. For cards that also use a thin border, leave the border constant during hover too (only its color may change) so the visible card outline never jitters during the interaction.
Start with border: 1px solid #e5e7eb and border-radius: 8px for a flat card. Add a subtle shadow of 0 1px 3px rgba(0,0,0,0.1) for the hybrid style. Increase border-radius to 12px for a modern open layout aesthetic. Compare the result against a shadow-only card with no border.
Step-by-step guide to css card border design generator:
Set border width and color
Start with border: 1px solid #e5e7eb for a flat card baseline. Adjust color to match your design token palette. Use a lighter value for secondary cards and a slightly darker value for featured cards.
Set border-radius
Choose a border-radius that matches your design system scale: 8px for standard cards, 12px for open layouts, 4px for compact data cards. Use one radius value consistently across all card variants.
Add box-shadow if using elevated style
Add one or two box-shadow layers. Start with box-shadow: 0 1px 3px rgba(0,0,0,0.1) for a subtle lift. Preview on your actual page background color to verify the shadow is visible.
Copy the CSS
Copy the generated card border CSS. Apply it to your card component and test with realistic content, multiple cards in a grid, and on different background colors.
Common situations where this approach makes a real difference:
Dashboard data card with flat border
A dashboard metrics card uses border: 1px solid #e5e7eb with border-radius: 6px and no shadow. The flat border creates a clean, structured appearance appropriate for data-dense interfaces where multiple cards sit in a tight grid. The solid border defines each card clearly without the visual noise of competing shadows across a dense layout.
Marketing feature card with hybrid border and shadow
A landing page feature card uses border: 1px solid #e5e7eb with border-radius: 12px and box-shadow: 0 2px 8px rgba(0,0,0,0.08). The generous radius and subtle shadow create a modern, approachable appearance. On hover, the shadow increases to 0 8px 24px rgba(0,0,0,0.12) with a transition to signal interactivity. The border stays constant to prevent layout shifts.
Selectable card in a plan picker
Plan selection cards use border: 2px solid #e5e7eb in their default state and border: 2px solid #6366f1 with background: #f0f4ff in their selected state. The transparent default pre-allocates the 2px border, so the selected state border appears without shifting the card. Adding border-radius: 8px and a consistent card width keeps the picker grid stable during selection changes.
Elevated card with shadow-only boundary
An app launcher panel uses shadow-only cards: no border, border-radius: 12px, and box-shadow: 0 4px 12px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08). The two-layer shadow creates visible elevation on a light gray background. On click, the shadow compresses to 0 1px 4px rgba(0,0,0,0.1) to simulate the card being pressed, giving tactile feedback through shadow animation.
Get better results with these expert suggestions:
Use two box-shadow layers for more natural card elevation
Real objects cast two shadows: a close, dense shadow directly below and a wider, softer ambient shadow further away. Two box-shadow values replicate this: box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06). The first layer is close and slightly opaque; the second is wider and less opaque. Together they produce a more convincing elevation than a single shadow at a higher opacity.
Reduce border opacity for elevated shadow cards
Cards that already have a prominent shadow do not need a high-contrast border. Setting border: 1px solid rgba(0,0,0,0.06) instead of a solid gray border lets the shadow do the visual work of defining the card boundary while the border only anchors the edge on high-contrast backgrounds. This produces a lighter, more refined card appearance.
Use selected state borders for interactive card grids
Cards in a selectable grid can use border to signal selection state. Default: border: 2px solid transparent. Selected: border: 2px solid #6366f1. The transparent default pre-allocates border space so the selected state does not shift the card or grid layout. Add background: #f0f4ff to the selected state for additional visual confirmation.
Dark mode cards typically need lighter borders and darker shadows
On dark backgrounds, light borders and dark shadows have reversed contrast. Dark mode cards benefit from border: 1px solid rgba(255,255,255,0.1) for a subtle white-tinted edge and box-shadow: 0 2px 8px rgba(0,0,0,0.4) for a deeper shadow that reads against the dark page. Test both modes at each radius and shadow combination to confirm the card is readable in both contexts.
Test card borders on your actual background color
A #e5e7eb border on a white background is clearly visible, but the same border on a #f9fafb background nearly disappears. Always preview your card border against the actual page background color. Increase border contrast slightly if the card sits on a non-white surface.
Increase shadow on card hover without changing border
Card hover interactions should not resize the card. Change only box-shadow intensity on :hover while keeping border and border-radius identical. Using transition: box-shadow 0.2s ease makes the hover shadow change smooth. This creates a clear elevation response to hover without any layout disruption.
Use border-radius consistently across card variants
A card grid with different border-radius values across card types looks inconsistent. Define one or two radius values for all card components and apply them as CSS variables. Mixing 8px and 12px cards in the same grid creates a visually noisy layout.
More use-case guides for the same tool:
Other tools you might find useful:
Open the full Border Builder — free, no account needed, works on any device.
Open Border Builder →Free · No account needed · Works on any device