David B.
David B.

Reputation: 314

Why does CSS box-shadow produce shadow's in unwanted positions?

Why does:

div { -webkit-box-shadow: 5px 0 20px #c1c1c1; }

put a shadow underneath the div when it's clearly set to 0?

Upvotes: 0

Views: 320

Answers (2)

David Thomas
David Thomas

Reputation: 253318

div { -webkit-box-shadow: 5px 0 20px #c1c1c1; }

Sets the -webkit-box-shadow with an offset of 5px (horizontal) and 0 (vertical) with a blur radius of 20px of colour #c1c1c1.

This means that the shadow isn't set to 0, it's just moved 0 vertically. If you want to have no shadow, either set the blur radius (20px) to 0 or remove the -webkit-box-shadow property.

Upvotes: 0

Robert
Robert

Reputation: 21388

It's not putting the shadow "underneath" the box, it's just bluring to the point that it's visible underneath. The parameters are:

-webkit-box-shadow: (Horizontal) (Vertical) (Blur) (Color);

http://jsfiddle.net/ngjpr/

Upvotes: 1

Related Questions