Code has been added to clipboard!

The CSS Box-Shadow Property

Reading time 2 min
Published Aug 8, 2017
Updated Oct 2, 2019

What's a CSS box shadow?

Using the box-shadow property, you can add a CSS box shadow effect for a selected element:

Example
div {
    box-shadow: 15px 15px 10px #4286f4;
}

CSS shadow syntax

The syntax for box-shadow is as follows:

box-shadow: h-shadow v-shadow blur spread color;

Example
div {
  box-shadow: 14px 22px 10px red; 
}

Property values

Value Description
none Default No CSS box shadow is displayed.
h‑shadow Required The horizontal offset.
Use a positive value for the right side of the box and a negative value for the left.
v‑shadow Required The vertical offset.
Use a positive value for the area below the box and a negative value for the area over the box.
blur Required The level of blur.
0 represents a sharp CSS box shadow. Higher number means more blur in a bigger area.
spread Optional The size of the CSS box shadow.
Use a positive value for bigger size and a negative value for smaller size.
color Optional The color of the CSS box shadow. Black by default.
Specify a custom one using color names, RGB, RGBA, HEX, HSL or HSLA values.

Tip: you can use the inset keyword to change the outset CSS shadow to an inner shadow.

Browser support

Chrome
10+
Edge
12+
Firefox
4+
IE
9+
Opera
10.5+
Safari
5.1+

Mobile browser support

Chrome
18+
Firefox
4+
Opera
All
Safari
5+
Tutorial
CSS3 Features
Syntax
Classes
ID Selectors
Attribute Selectors
Stylesheets
Inline
Internal
External
Box Model
Children Selectors
Pseudo Classes
Pseudo Elements
Variables
Counters
Text
Fonts
Web Fonts
Backgrounds
Background Images
Colors
Gradients
Opacity / Transparency
Shadow Effects
Transitions
Tooltip
Transform
Animations
Layout — Display
Layout — Position
Layout — Float
Layout — Clear
Layout — Horizontal & Vertical Align
Multiple Columns
Introduction
Responsive Web Design — Viewport
Responsive Web Design — Grid View
Responsive Web Design — Media Queries
Responsive Web Design — Flexbox Layout
Responsive Web Design — Images
Responsive Web Design — Videos
Borders
Margin
Padding
Width
Height
Outline
Links
Lists
Tables
Dropdown Menu
Navigation Bar
Images
Image Gallery
Border Images
Forms
Rounded Corners
Buttons
Box-Sizing
Selector Reference
Pagination Examples
Code Examples
CSS3 Browser Support Reference
Functions Reference
Speech Module Reference
Units
Web Safe Font Combinations
Cheat Sheet
:hover
@font-face
@keyframes
@media
align-content
align-items
align-self
all
animation
backface-visibility
background
background-clip
background-color
background-image
background-origin
background-position
background-size
border
border-image
border-radius
border-style
box-shadow
box-sizing
color
columns
filter
flex
flex-basis
flex-direction
flex-flow
flex-grow
flex-shrink
flex-wrap
font
font-family
font-size
font-size-adjust
font-stretch
font-style
font-weight
hanging-punctuation
justify-content
line-height
margin
offset
opacity
order
outline
overflow
padding
perspective
position
resize
tab-size
text-align
text-decoration
text-emphasis
text-transform
text-shadow
transform
transition-property
translate
vertical-align
word-break
word-wrap
z-index