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?

Inversion Therapy Table

Aching back from coding all day? Try Back Problems

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price
119.98119.98Amazon 4.5 logo(1,700+ reviews)

More Back Problems resources

Build modern and responsive webpages

HTML & CSS

Build modern and responsive webpages Try Front-end

This book teaches HTML as if it's for anyone - hobbyists, students, and professionals - and it's full-color throughout. It utilizes information graphics and lifestyle photography to explain the topics in a simple way that is engaging. You can progress through the chapters from beginning to end or just dip into topics of particular interest at your leisure.

$ Check price
29.9929.99Amazon 4.5 logo(926+ reviews)

More Front-end resources

Ad