使用 CSS 设置插入和起始框阴影
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22438457/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set both inset and outset box shadow using CSS
提问by Iter Ator
The box-shadow
property has a property value called inset
, so the shadow can be inset, or outset.
该box-shadow
属性有一个名为 的属性值inset
,因此阴影可以是inset或outset。
But how is it possible, to set both inset, and outsetshadow for a div
in CSS?
但是如何在 CSS 中为 a设置inset和outset阴影div
呢?
回答by Mr. Alien
You need to separate them using a ,
您需要使用 a 将它们分开 ,
div {
margin: 100px;
height: 100px;
width: 100px;
border: 1px solid #aaa;
border-radius: 50%;
box-shadow: inset 0 0 5px tomato, 0 0 5px black;
}
Demo 2(Nothing different, but used white
border
for better indication)
Demo 2(没有什么不同,但用于white
border
更好的指示)
So here in the above example, it sets the shadow insetwith the tomato
color, and the other set of rules separated using a comma is for outseti.e black
shadow
所以在上面的例子中,它用颜色设置阴影插入,tomato
使用逗号分隔的另一组规则用于开始,即black
阴影