css - “inset” 之后的参数在这个 CSS box-shadow 语法中是什么意思?

标签 css

我遇到了一个使用以下语法编写的 box-shadow 属性:

box-shadow: 0 1px 1px rgba(0,0,0,0.24),inset 0 -22px rgba(23,49,76,0.03);

我关注了 w3s box-shadow 的文档,直到 inset 参数之后才明白它的意思。 inset 之后的附加参数在那里没有阐明。

那么,这些附加值的含义是什么?

0 -22px rgba(23,49,76,0.03)

最佳答案

你描述的参数其实是另一个box-shadow的偏移量和颜色。值中的逗号 (,) 表示正在定义两个框阴影。

一些不同的缩进可能会使其更清晰:

box-shadow: 0 1px 1px rgba(0,0,0,0.24),/* <-- Note the comma here, separating the two box shadows */
            inset 0 -22px rgba(23,49,76,0.03);

The W3C’s box-shadow documentation ( which is more reliable than w3schools.com — w3schools is not linked with the W3C, despite their name ) 提到了这一点:

The ‘box-shadow’ property attaches one or more drop-shadows to the box. The property takes a comma-separated list of shadows

关于css - “inset” 之后的参数在这个 CSS box-shadow 语法中是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25606268/

相关文章:

css - 当屏幕分辨率在 Bootstrap 3 中降低时从右到左堆叠列

css - 修改wordpress主题的麻烦

asp.net datalist - 更改样式

css - LESS.css 嵌套规则 - 这是有效的 LESS 吗?

javascript - HTML/Javascript - 创建自动滚动的页面部分,并在顶部文本离开屏幕时将其删除

jquery - Fancybox 删除滚动,移动页面

css - body { 字体大小 : 100. 01%; } vs body { 字体大小 : 100%; }?

html - 文本高度为 100% 的旋转垂直菜单

html - 屏幕分辨率降低时不缩小 CSS/HTML

css - css中的圆形倾斜顶部形状