box-shadow使用指南
Summary
The box-shadow
property describes one or more shadow effects as a comma-separated list. It enables you to cast a drop shadow from the frame of almost any element. If aborder-radius
is specified on the element with a box shadow, the box shadow takes on the same rounded corners. The z-ordering of multiple box shadows is the same as multiple text shadows (the first specified shadow is on top).
Box-shadow generator is an interactive tool allowing you to generate a box-shadow.
Values
inset :<是否为内部阴影>
If not specified (default), the shadow is assumed to be a drop shadow (as if the box were raised above the content).
The presence of the inset
keyword changes the shadow to one inside the frame (as if the content was depressed inside the box). Inset shadows are drawn inside the border (even transparent ones), above the background, but below content.
<offset-x>
<offset-y> :<阴影左右偏移量>
These are two <length>
values to set the shadow offset. <offset-x>
specifies the horizontal distance. Negative values place the shadow to the left of the element.<offset-y>
specifies the vertical distance. Negative values place the shadow above the element. See <length>
for possible units.
If both values are 0
, the shadow is placed behind the element (and may generate a blur effect if <blur-radius>
and/or <spread-radius>
is set).
<blur-radius> :<边缘虚化程度>
This is a third <length>
value. The larger this value, the bigger the blur, so the shadow becomes bigger and lighter. Negative values are not allowed. If not specified, it will be0
(the shadow's edge is sharp). The specification does not include an exact algorithm for how the blur radius should be calculated, however, it does elaborate as follows:
…for a long, straight shadow edge, this should create a color transition the length of the blur distance that is perpendicular to and centered on the shadow’s edge, and that ranges from the full shadow color at the radius endpoint inside the shadow to fully transparent at the endpoint outside it.
<spread-radius> :<边缘伸缩长度>
This is a fourth <length>
value. Positive values will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink. If not specified, it will be0
(the shadow will be the same size as the element).
<color> : <边框颜色>
See <color>
values for possible keywords and notations.
If not specified, the color used depends on the browser - it is usually the value of thecolor
property, but note that Safari currently paints a transparent shadow in this case.
Live examples
Browser compatibility
原文地址:https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
最新文章
- C#基础强化-继承与多态
- mtk开发
- Linux LVM全面实践
- WM_CLOSE WM_DESTROY WM_QUIT的区别
- PSAM卡与CPU(用户卡)的操作过程
- coffeescript 1.8.0 documents
- 升级ssh编译错误
- 千万别在开发阶段用 uglify 插件了!(from Requirejs to Webpack)
- java常用的框架介绍
- DWM1000 自动应答代码实现与实例
- Python列表,字典和字符串操作
- 《Maven实战》文字版[PDF]
- mvn 修改所有子项目pom版本
- 安卓操作系统版本(Version)与应用程序编程接口等级(Application Programming Interface Level)对照表
- INCLUDE COMMON FILES IN HTML USING JQUERY
- 树莓派3b 串口通信初次尝试
- git忽略某个文件
- Spring Boot(六)自定义事件及监听
- IOS 发布被拒 PLA 1.2问题 整个过程介绍 02 个人账户升级公司账户
- python3入门