Trusted answers to developer questions

What is the CSS box-shadow property?

Get the Learn to Code Starter Pack

Break into tech with the logic & computer science skills you’d learn in a bootcamp or university — at a fraction of the cost. Educative's hand-on curriculum is perfect for new learners hoping to launch a career.

The box-shadow property is used to create a shadow effect around an HTML element.

svg viewer

The box-shadow property can have the values below. These values define the shadow’s characteristics:

value description
h-offset The horizontal offset of a shadow. A positive value creates a shadow on the right, and a negative value creates a shadow on the left.
v-offset A positive vertical offset creates a shadow below the box, and a negative offset creates one above the box.
blur The blur radius of the shadow.
spread The size of the shadow.
color The color of the shadow.
inset Changes the shadow from an outer shadow to an inner shadow.

Syntax

These values take the following order in the syntax:

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

Code

RELATED TAGS

css
box-shadow
property
styling
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?