Introduction to Elevation in Modern UI
Shadows are the building blocks of depth. In digital interfaces, they simulate physical elevations relative to ambient light. Flat design without shadows often looks cheap, whereas harsh, single-layer dark shadows make pages look cluttered.
# The Physics of Shadows
Real-world shadows are rarely single-layered. They consist of a dark core (ambient occlusion) and a soft, spread-out penumbra. To replicate this in CSS, you should stack multiple box-shadow layers.
## Standard (Single Layer) Shadow ```css /* Looks harsh and unnatural */ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); ```
## Ambient (Multi-Layer) Shadow ```css /* Soft, realistic ambient look */ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04), 0 8px 16px rgba(0, 0, 0, 0.08); ```
Key Best Practices
- **Lower the Opacity**: Keep opacity values between 3% and 10%.
- **Harmonize Tint Colors**: Instead of using pure black (#000) for shadows, use a darkened tint of the background color (e.g., navy blue on blue screens) to make blending natural.
- **Control Hover States**: Shift shadow translation vertically on hover to increase tactile responsive feedback.