06. Box Border Effects box-shadow

Just like how we can apply a shadow on text, we can also apply a shadow on a box.

Box Shadow

To add a shadow around a box, we can use the box-shadow property.

There are six values that we must pass it, in order:

Horizontal offset
How far the shadow should be off to the right.
Vertical offset
How far the shadow should below the box edge.
Blur
To blur our shadow, we specify our third value, or the blur-radius.
The higher the value, the more blurry our shadow becomes.
Spread distance
The higher the value, the larger the shadow.
Color
Lastly, we may specify a color, the default being black.
Inner Shadow (optional)
To add an inner shadow, we insert the value "inset".

The following code will produce the Sample Box below:

#box {
  box-shadow: 2px 4px 7px 2px blue;
  margin: 10px;
  padding: 10px;
}
Sample Box

Aching back from coding all day?

Acupressure Mat & Pillow

Aching back from coding all day? Try Back Problems

Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.

$$ Check price
144.87144.87Amazon 4.5 logo(1,890+ reviews)

More Back Problems resources

Build modern and responsive webpages

The Modern Web

Build modern and responsive webpages Try Front-end

The Modern Web will guide you through the most important tools of device-agnostic web development, including HTML5, CSS3, and JavaScript. The plain-english explanations and practical examples emphasize the techniques, principles, and practices that you'll need to easily transcend individual browser quirks and stay relevant as these technologies are updated.

$ Check price
34.9534.95Amazon 4.5 logo(30+ reviews)

More Front-end resources

Ad