“插入”之后的参数在这个CSS box-shadow语法中意味着什么?

时间:2014-09-01 12:50:07

标签: css

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

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

我按照box-shadow的{​​{3}}文档获取了inset参数之后的含义。 inset之后的其他参数在那里没有明确说明。

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

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

1 个答案:

答案 0 :(得分:2)

您描述的参数实际上是另一个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 documentationwhich is more reliable than w3schools.com — w3schools is not linked with the W3C, despite their name)提及:

  

'box-shadow'属性会在框中附加一个或多个阴影。该属性采用逗号分隔的阴影列表