Quick Answer
A typical card shadow uses box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.1), which creates a subtle downward shadow with 6px blur and 10% opacity.
Shadow Properties
Preview
Common Examples
| Input | Result |
|---|---|
| 0px 4px 6px 0px, #000000 at 10% opacity | box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.1); |
| 0px 10px 25px -5px, #000000 at 20% opacity | box-shadow: 0px 10px 25px -5px rgba(0, 0, 0, 0.2); |
| inset 0px 2px 4px 0px, #000000 at 15% opacity | box-shadow: inset 0px 2px 4px 0px rgba(0, 0, 0, 0.15); |
| 5px 5px 0px 0px, #3B82F6 at 100% opacity | box-shadow: 5px 5px 0px 0px rgba(59, 130, 246, 1); |
| 0px 20px 60px 0px, #000000 at 30% opacity | box-shadow: 0px 20px 60px 0px rgba(0, 0, 0, 0.3); |
How It Works
The CSS box-shadow property adds one or more shadow effects to an element. Each shadow is defined by up to six values.
Syntax
box-shadow: [inset] offset-x offset-y blur-radius spread-radius color;
Where:
- inset (optional): places the shadow inside the element instead of outside
- offset-x: horizontal displacement. Positive values move the shadow right, negative values move it left.
- offset-y: vertical displacement. Positive values move the shadow down, negative values move it up.
- blur-radius: controls the blur. A value of 0 creates a sharp shadow. Higher values create softer, more diffused shadows. The blur algorithm expands the shadow by this radius in all directions and then applies a Gaussian blur.
- spread-radius: expands or contracts the shadow. Positive values make the shadow larger than the element, negative values make it smaller. A spread of -5px with an offset of 10px creates a shadow that appears only on one side.
- color: typically specified as rgba() to control opacity. rgba(0, 0, 0, 0.1) is black at 10% opacity.
Common Shadow Patterns
- Subtle card: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06)
- Medium elevation: 0 4px 6px rgba(0,0,0,0.1)
- Heavy elevation: 0 20px 60px rgba(0,0,0,0.3)
- Inset pressed: inset 0 2px 4px rgba(0,0,0,0.15)
- Retro hard shadow: 5px 5px 0 #000000
Worked Example
For a card with a subtle bottom shadow at 10% opacity: offset-x = 0 (centered horizontally), offset-y = 4px (shifted down), blur = 6px (soft), spread = 0 (no expansion), color = rgba(0, 0, 0, 0.1). The result is box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.1);. The 6px blur extends the shadow 6px beyond its offset position and applies a Gaussian fade. At 10% opacity, the shadow is visible but does not dominate the design.
Related Calculators
Frequently Asked Questions
What is the difference between blur and spread?
How do I create a shadow on only one side?
Can I add multiple shadows to one element?
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);. The first shadow in the list renders on top. Layered shadows create more realistic depth effects than a single shadow.
What is an inset shadow?
inset keyword places the shadow inside the element instead of outside. Inset shadows create a pressed or recessed appearance. They follow the same offset, blur, spread, and color syntax. Common use cases include form input focus states and toggle button pressed states.
CalculateY