ToolypetMCP
beginner3 minutescss

Card Component Style

Build a modern card component with shadow, border radius, hover transform, and smooth transitions.

cardshadowborder-radiustransform

इस रेसिपी का उपयोग कब करें

Cards are one of the most common UI patterns. This recipe creates a card that feels interactive and polished, suitable for product listings, blog posts, or dashboard widgets.

चरण

1

Add Material Design-inspired shadow

प्रॉम्प्ट:Generate a card shadow: 0 1px 3px rgba(0,0,0,0.12) and 0 1px 2px rgba(0,0,0,0.24)
2

Round the card corners

प्रॉम्प्ट:Generate 12px border radius for all corners
3

Create lift-on-hover effect

प्रॉम्प्ट:Generate translateY(-4px) transform for hover state
4

Smooth the hover transition

प्रॉम्प्ट:Generate a smooth ease-out cubic-bezier for 200ms transition

अक्सर पूछे जाने वाले प्रश्न

Should I use box-shadow or drop-shadow for cards?

box-shadow is preferred for cards as it supports spread radius and multiple shadows. drop-shadow is better for irregular shapes.

How do I add a border on hover instead?

Replace the transform step with a border-color transition. Use border: 2px solid transparent transitioning to a visible color.

संबंधित रेसिपी