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

box-shadow使用指南的更多相关文章

  1. 如何设置box shadow的透明度

    (从已经死了一次又一次终于挂掉的百度空间人工抢救出来的,发表日期2014-04-24) 今天发现使用box-shadow属性,可以很好的给div添加阴影效果,但是添加的效果如果是: -moz-box- ...

  2. 分享div、text、Box Shadow(阴影)演示及代码的页面

    附图: 直接上链接:www.css88.com/tool/css3Preview/Box-Shadow.html

  3. Web 前端从入门菜鸟到实践老司机所需要的资料与指南合集

    http://web.jobbole.com/89188/ 2016 – 对于未来五年内Web发展的7个预测 2015 – 我的前端之路:从命令式到响应式,以及组件化与工程化的变革 怎么成为一名优秀的 ...

  4. webAssmebly实现js数组排序 使用custom elements和Shadow DOM自定义组件

    直接上码了……………… .wat源码 (module (type $t0 (func (param i32 i32))) (type $t1 (func (result i32))) (type $t ...

  5. 有趣的 CSS 像素艺术

    原文地址:https://css-tricks.com/fun-times-css-pixel-art/#article-header-id-4 译者:nzbin 友情提示:由于国内网络的原因,Cod ...

  6. 来看看css3中的box-shadow

    不谈IE,只谈谈box-shadow的具体使用方法 语法: E {box-shadow: <length> <length> <length>?<length ...

  7. 关于box-shadow属性的一点心得

    一般我用到box-shadow都是用于诸如按钮,文本块,某些图标,css类似为: box-shadow: 1px 1px 5px rgba(0, 0, 0, .8); 这样,样式看上去会更加柔和,或者 ...

  8. CSS3 Border-image

    CSS3中有关于border的属性我们一起学习完了圆角border-radius和边框颜色border-color,只剩下最后一个边框图片border-image.今天我们就一起来学习这个border ...

  9. 初学c# -- 学习笔记(五) winfrom无边框四周阴影

    刚用到这个功能,网上扯淡的东西太多了,都是2边阴影,还什么窗口叠加.ps作图啥的,什么玩意.还是老外实在,google找的,无边框窗体,四边透明阴影. public partial class For ...

随机推荐

  1. var_dump(is_writeable(ini_get("session.save_path")));

    var_dump(is_writeable(ini_get("session.save_path")));

  2. hdwiki中模板的使用说明

    HDwiki所有模版文件都在根目录view下的default文件里,以admin_开头的是后台的模版文件,其它不是以admin_开头的,就是所有的前台文件.具体列表如下:首页模版文件:  index. ...

  3. 简单选择排序(Java)

    简单选择排序: 每一趟在整个记录中找到最小的那个作为有序序列的第i个记录. class SelectSort{ public void p(int[] a){ for(int i=0;i<a.l ...

  4. SQLite详解

    一.新建SQLite操作类(继承SQLiteOpenHelper) public class SQLiteTest extends SQLiteOpenHelper { final static St ...

  5. c# 遍历子控件,比如Form下的group,或者panel

    方法很好用.目的是遍历所有容器的子控件... 方法1private void GetControl(Control.ControlCollection ctc, ref int checkNull) ...

  6. SQL语句,给自己的记录

    1.group by 和求和函数的使用 select className,SUM(num) as sumNum FROM test GROUP BY className 2.更新一个字段的所有值 up ...

  7. Netfilter/iptables防火墙

    http://os.51cto.com/art/201107/273443.htm [51CTO独家特稿]Linux系统管理员们都接触过Netfilter/iptables,这是Linux系统自带的免 ...

  8. C#之猴子吃桃儿问题的解法——猴子吐桃儿

    猴子第一天摘了许多个桃子,先吃了所有桃子的一半,后又吃了一个:第二天又吃了剩下桃子的一半,后又吃了一个……第十天,剩1个桃子.问:猴子第一天摘了多少个桃子? 首先对“猴子吃桃”的过程进行正向推导,设: ...

  9. easyui commbox嵌入一个checkbox的实现

    function InitComBoBox(datagrid, combxid, formid, url, valueField, textField,_prompt) { $(combxid).co ...

  10. Ubuntu安装后的一些配置

    对新安装的Ubuntu的一些配置: #移除无用包 apt-get remove libreoffice-common apt-get remove unity-webapps-common apt-g ...