The shadow attributes implemented in css3 include: 1. text-shadow attribute, which can achieve text shadow effect; 2. box-shadow attribute, which can achieve border shadow effect; 3. filter attribute, which needs to be combined with drop-shadow() Used together with the function, you can set a shadow effect on the image.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
css3 implements shadow attribute
1. text-shadow attribute---implements text shadow effect
The text-shadow property is used to set shadowed text; you can set the pixel length, width and blur distance of the shadow, as well as the color of the shadow.
2. box-shadow attribute--achieve border shadow effect
The box-shadow attribute can apply shadow to text Box, you can set the pixel length, width and blur distance of the shadow as well as the color of the shadow.
box-shadow can add shadows to elements, supporting adding one or more.
box-shadow: X轴偏移量 Y轴偏移量 阴影模糊半径 阴影扩展半径 阴影颜色 投影方式;
Parameters:
Note: inset can be written in the first or last parameter, other positions are invalid.
This parameter is optional. The value can only be positive. If the value is 0, it means that the shadow has no blur effect. The larger the value, the smaller the edge of the shadow. Vague.
css code:
#box{ width:50px; height:50px; background:#fff; box-shadow:4px 4px 15px #666; }
Effect:
Shadow expansion radius:
This The parameter is optional, and the value can be positive or negative. If the value is positive, the entire shadow will expand and expand. Otherwise, if the value is negative, it will shrink.
css code:
#box{ width:50px; height:50px; background:#fff; box-shadow:4px 4px 15px -3px #666; }
Effect:
X-axis offset And the Y-axis offset value can be set to a negative number
The X-axis offset is a negative number:
#box{ width:50px; height:50px; background:#fff; box-shadow:-5px 5px 5px #666; }
Effect:
Y-axis offset is negative:
#box{ width:50px; height:50px; background:#fff; box-shadow:5px -5px 5px #666; }
Effect:
##Outer shadow:#box{ width:50px; height:50px; background:green; box-shadow:5px 4px 10px #666; }
#box{ width:50px; height:50px; background:#fff; box-shadow:5px 4px 10px #666 inset; }
#box{ width:50px; height:50px; background:#fff; box-shadow:5px 4px 10px #666 inset, 3px 3px 5px pink, 6px 4px 2px green; }
3. filter attribute
The filter attribute defines the element (usually ) Visual effect, when used with the drop-shadow() function, can set a shadow effect on the image.filter:drop-shadow(h-shadow v-shadow blur spread color);
查看
(学习视频分享:css视频教程)
The above is the detailed content of What are the shadow attributes implemented in css3. For more information, please follow other related articles on the PHP Chinese website!