CSS3 box-shadow
The CSS3 box-shadow property can be used to design the shadow effect of each block in the webpage. For example, DIV , span , img can easily design good-looking shadow effects. As for why it is necessary to design shadows? Because traditional web design is relatively monotonous, the use of proper shadow can indeed improve the overall texture of the web page, but it should not be used too much, otherwise the page will be messy and lose its quality. The usage of CSS box-shadow is similar to text-shadow , but text-shadow is only applicable For text shadows, box-shadow is more suitable for block design. Mainstream browsers such as FireFox, Chrome, Safari, Opera, etc. all support the box-shadow attribute, but IE9 and earlier versions of IE do not support it.
CSS3 box-shadow basic syntax
- inset: used to set the inner shadow, optional items, no fill-in represents the outer shadow.
- offset-x: the size of the shadow in the x-axis direction, in units of length, such as em, px, etc.
- offset-y: the size of the shadow in the y-axis direction, in units of length, such as em, px, etc.
- blur-radius: Blur radius, optional item, default value zero if not filled in.
- spread-radius: Spread radius, optional item, default value zero if not filled in.
- Shadow color: Necessary items, decide the color of the shadow by yourself.
CSS3 box-shadow example 1: simple DIV shadow
In order to make the example more clear, we made a little design for the DIV, including width, line-height , text-align, etc., but the focus is still on the red-marked shadow design. The horizontal and vertical directions are both 3px distance. , The blur range is 12px distance, you can show such a soft effect.
CSS3 box-shadow example 2: DIV inner shadow inset
CSS3 box-shadow example 3: Add shadow effects to pictures
Post a Comment
0 Comments