Home
Bookmarks
Leagues
LEARN
Courses
Career Paths
Assessments
Tutorials
Arcade
Glossary
GROW
Certifications
Log in
Glossary
Log inSign up
Courses/UX Design Foundations/Intro to Shadows
Level 3 · Elements of Design II

Intro to Shadows

14 min read
6 exercises
250 XP
Start lesson

Ready to test what you learned?

Complete the lesson quiz and earn 250 XP.

Start quiz

Topics in this lesson

The Physics of Light: Virtual Sunlight & Ambient OcclusionDeconstructing CSS Box-Shadow PropertiesLayered Shadows: Avoiding the Muddy Black Anti-PatternElevation Hierarchy and Design System TokensShadows in Dark Mode: Tonal Elevation vs. OpacityCognitive Affordance: Communicating Interactivity and Drag States

From Course

📘
UX Design FoundationsBeginner · 25 lessons
Intro to Shadows

Lesson

Intro to Shadows

The Physics of Light: Virtual Sunlight & Ambient OcclusionDeconstructing CSS Box-Shadow PropertiesLayered Shadows: Avoiding the Muddy Black Anti-PatternElevation Hierarchy and Design System TokensShadows in Dark Mode: Tonal Elevation vs. OpacityCognitive Affordance: Communicating Interactivity and Drag States
Start lesson
Complete lesson and earn 250 PX
Exercise #1

The Physics of Light: Virtual Sunlight & Ambient Occlusion

In digital interface design, shadows simulate a virtual physical environment governed by consistent optical rules:

  • Virtual Light Source: By universal convention in UI systems, the primary light source is positioned above and slightly in front of the screen. Light casts downwards, making positive Y-offsets standard.
  • Direct Shadow vs. Ambient Occlusion:
    1. Direct Cast Shadow: Directional shadow cast along the light angle (sharp, offset downwards).
    2. Ambient Occlusion: Soft, diffuse darkness that settles where two physical surfaces meet or sit in close proximity, independent of light angle.

Top-tier design systems layer both components together for realistic physical depth.

Exercise #2

Deconstructing CSS Box-Shadow Properties

In CSS and design tooling, box-shadow is defined by five parameters:

box-shadow: <x-offset> <y-offset> <blur-radius> <spread-radius> <color>;
  1. X-Offset: Horizontal displacement (typically 0px in UI to preserve centered lighting).
  2. Y-Offset: Vertical displacement. Higher values indicate higher elevation above the canvas.
  3. Blur Radius: How softly the shadow feathers out. Higher elevation equals a larger, softer blur.
  4. Spread Radius: Expands or contracts the shadow footprint before blurring. Negative spread helps keep deep shadows from looking unnaturally oversized.
  5. Color & Alpha: Must always use transparent alpha channels (rgba(0,0,0, 0.08)), never opaque grays.
Exercise #3

Layered Shadows: Avoiding the Muddy Black Anti-Pattern

A single harsh shadow (e.g., box-shadow: 0 10px 20px rgba(0,0,0,0.4)) looks amateur, heavy, and creates a 'muddy' edge that distracts from content.

The Multi-Layer Technique

To create realistic, smooth shadows that mimic natural ambient lighting, combine two or more subtle shadow declarations:

/* Smooth, realistic card shadow */
box-shadow:
  0 1px 2px rgba(0, 0, 0, 0.04), /* Crisp ambient contact shadow */
  0 8px 16px rgba(0, 0, 0, 0.06); /* Soft, diffused elevation cast */

Multi-layered shadows maintain crisp edge definition near the element while casting a gentle atmospheric blur into the distance.

Exercise #4

Elevation Hierarchy and Design System Tokens

Design systems organize depth into a systematic scale of elevation tokens mapped to real-world interface roles:

  • Elevation 0 (Base Canvas): Flat page canvas, form inputs, table rows. No shadow.
  • Elevation 1 (Cards & Lists): box-shadow: 0 1px 3px rgba(0,0,0,0.06). Content containers resting slightly above the canvas.
  • Elevation 2 (Hovered Cards & Dropdowns): box-shadow: 0 4px 12px rgba(0,0,0,0.08). Floating popovers and dropdown menus.
  • Elevation 3 (Sticky Navbars & Side Drawers): box-shadow: 0 12px 24px rgba(0,0,0,0.12). Persistent navigation hovering over page content.
  • Elevation 4 (Modal Dialogs): box-shadow: 0 24px 48px rgba(0,0,0,0.18). Critical interrupting overlays requiring absolute user focus.
Exercise #5

Shadows in Dark Mode: Tonal Elevation vs. Opacity

Against a dark charcoal or black canvas, dark drop shadows become invisible. Applying black shadows to dark mode surfaces provides zero perceived elevation.

Dark Mode Elevation Rules

  1. Lighten Surface Tones: The higher an element's elevation, the closer it is to the virtual light source. Therefore, higher elevation surfaces must use progressively lighter shades of gray or charcoal.
  2. Subtle 1px Border Highlights: Add a delicate 1px border stroke (rgba(255, 255, 255, 0.08)) around elevated dark cards to define physical edges.
  3. Deep Ambient Shadows: When dark cards overlap other dark cards, use subtle black ambient occlusion with a larger spread to prevent visual blending.
Exercise #6

Cognitive Affordance: Communicating Interactivity and Drag States

Shadows are functional signifiers that communicate tactile state changes:

  • Rest State: Subtle Elevation 1 indicates the card is distinct from the background.
  • Hover State: Transitioning from Elevation 1 to Elevation 2 (shadow extends downward as the card visually lifts toward the user) communicates clickability.
  • Active / Pressed State: Shadow collapses down to Elevation 0, signaling the button has been physically depressed into the screen.
  • Drag-and-Drop State: The card leaps to Elevation 4 with a deep, diffused shadow and slight rotation, confirming to the user that it is detached from the grid and mobile.