05 Box Shadow 101006074734 Phpapp02
05 Box Shadow 101006074734 Phpapp02
BOX-SHADOW
The CSS3 box-shadow property allows you to apply one or more shadows to any box.
An outer box-shadow casts a shadow as if the box were opaque. The shadow is drawn outside the border edge only.
An inner box-shadow casts a shadow as if everything outside the box were opaque. The inner shadow is drawn inside the padding edge only.
Browser support
box-shadow syntax
The property allows 4 <length> values, a color value and an optional inset keyword.
Horizontal offset
A positive value will place the shadow on the right of the box.
Box
A negative value will place the shadow on the left of the box.
Box
Vertical offset
Box
Box
Blur radius
Box
The higher the blur radius number, the softer the box-shadow will be.
.test { box-shadow: 10px 10px 10px 5px #000 inset; }
Box
Soft box-shadow
Spread distance
Positive values cause the shadow to expand in all directions (so the shadow appears larger than the box).
.test { box-shadow: 10px 10px 5px 5px #000 inset; }
Negative values cause the shadow to contract in all directions (so the shadow appears smaller than the box).
.test { box-shadow: 10px 10px 5px -5px #000 inset; }
Color
inset
If the inset keyword is present, browsers will render the box with an inset shadow.
.test {
box-shadow: 10px 10px 5px 5px #000 inset;
Box-shadow must include the two offset values. Blur radius, spread, shadow color and inset are optional.
.test { }
essential optional
If no blur radius is specified, browsers will assume a 0 value and the shadow will be hard edged.
.test { }
If no spread is specified, browsers will assume a 0 value and the shadow will be the same size as the box.
.test { }
Zero value used if none defined
If no color is specified, a user-agent color should be used. Most browsers use the color of the text.
Safari 5.0 and Chrome 9.0 do not render the box-shadow unless a color is included. Text color value used if none defined
.test { }
If no inset keyword is defined, browsers will assume the shadow is not inset.
.test { }
Multiple box-shadows
.test { Box-shadow 1 box-shadow: 10px 10px 5px #000, 20px 20px 20px yellow; }
.test { Comma separator box-shadow: 10px 10px 5px #000, 20px 20px 20px yellow; }
.test { box-shadow: 10px 10px 5px #000, 20px 20px 20px yellow; }
Box-shadow 2
The shadow effects are applied front-to-back: the first shadow is on top and the others are layered behind.
Box
Box-shadow 1
Box-shadow 2
The box-shadow should follow any curved corners that have been defined with border-radius.
Russ Weakley
Max Design
Site: maxdesign.com.au Twitter: twitter.com/russmaxdesign Slideshare: slideshare.net/maxdesign Linkedin: linkedin.com/in/russweakley