Box-shadow is to add a perimeter shadow effect to an element block
Grammar:
Object Selector {box-shadow:x axis offset y-axis offset shadow blur radius Shadow expansion radius shadow color [projection mode]}
Box-shadow:h-shadow v-shadow blur spread color inset;
| value |
Description |
| H-shadow |
The position of the horizontal shadow, required |
| V-shadow |
The position of the vertical shadow, required |
| Blur |
Blur Distance |
| Spread |
The size of the shadow |
| Color |
Shadow color |
| Inset |
Inner shadow, default is outer shadow |
How to use:
. Box { /*Firefox*/ -moz-box-shadow:h-shadow v-shadow Blur spread color Inset; /* Safari and Chorm */ -webkit-box-shadow:h-shadow v-shadow blur spread color inset; box-shadow:h-shadow v-shadow blur spread color inset; }
1, do not specify the shadow color of the property, the shadow in the WebKit kernel under the Safari and chrome display under the transparent color, in Firefox/opera under the black, so develop a good habit, it is best to set the color better.
2, no offset, shadow size/blur radius 20px,
0 0 20px #0cc, equivalent to box 0 0 20px rgb (0,204,204);
The color value has two kinds of writing, one is the RGB writing, one is 16 binary notation
3, color and transparency, with RGBA
box-shadow:0 0 20px Rgba (0,204,204,.5);
4, blur degree 0, shadow expansion radius 10px
box-shadow:0 0 0 10px #0cc;
5. Turn the default outer shadow into an inner shadow
Box-shadow:inset 0 0 20px 10px #0cc; or box-shadow:0 0 20px 10px #0cc inset;
6, multiple shadows, first written in the top-level display
box-shadow:0 0 10px 5px Green, 0 0 10px 20px Red, 0 0 10px 30px Blue;
7, ie under the Box-shadow
Under IE set the shadow, use its shadow filter, also only IE has, good bored bar
Basic syntax:
Filter:progid:DXImageTransform.Microsoft.Shadow (color= ' color value ', direction= shadow Angle (value), strength= shadow radius (value)); must also be used with the background property, otherwise invalid
/* For ie6,7,8 */ Filter:progid:DXImageTransform.Microsoft.Shadow (color= ' #969696 ', direction=135, strength=5);
=======================================================================
A complete compatible Box-shadow should be written like this:
. Box{Filter:Progid:DXImageTransform.Microsoft.Shadow (color= ' #0cc, direction=135, strength=5);/*For ie6,7,8*/Background-color:#ccc;-moz-box-shadow:2px 2px 5px #0cc;/*Firefox*/-webkit-box-shadow:2px 2px 5px #0cc;/*WebKit*/Box-shadow:2px 2px 5px #0cc;/*Opera or IE9*/}
Css3:box-shadow Shadow