css教程网 css教程网365css.cn
公告为您打开互联网世界的窗户关于本站
首页/属性速查/边框与效果

box-shadow

盒子阴影,支持多层叠加与 inset。

语法
box-shadow: <offset-x> <offset-y> <blur> <spread> <color>?, ...
常用值
0 24px 48px -18px rgb(43 87 255 / .35) / inset 0 1px 0 #fff
初始值
none
继承
否

运行效果

示例改成别的值试试,差异一眼能看出来
查看代码
HTML
<div class="bsh"><i></i></div>
CSS
.bsh { padding: 14px; }
.bsh i { display: block; width: 110px; height: 62px; border-radius: 10px; background: #fff; border: 1px solid #eef2f9; box-shadow: 0 2px 6px -1px rgba(13,17,23,.08), 0 20px 40px -18px rgba(43,87,255,.45); }

使用要点

  • 负扩散 + 大模糊最自然,阴影会集中在物体下方。
  • 阴影不占布局空间,不影响点击区域。