开发者

Default box shadow color? [duplicate]

This question already has answers here: Is there a 'box-shadow-color' property? 开发者_运维百科 (5 answers) Closed 9 years ago.

What color do the *box-shadows default to if none is specified?

-webkit-box-shadow: 4px 4px 5px;
-moz-box-shadow: 4px 4px 5px;
box-shadow: 4px 4px 5px;

How can I set that color separately? (According to Is there a 'box-shadow-color' property? there isn't a thing such as *box-shadow-color ...)


See: https://developer.mozilla.org/en/css/box-shadow

<color> (optional)
See <color> values for possible keywords and notations. If not specified, the color depends on the browser. In Gecko (Firefox), the value of the color property is used. WebKit's shadow is transparent and therefore useless if <color> is omitted.

You can only set the color inside box-shadow, for example:

box-shadow: 4px 4px 5px #ccc;

You simply can't set it separately, because as you pointed out, no box-shadow-color property exists.


While there isn't a box-shadow-color property yet, box-shadow defaults to color, just like border does.

In practice, you have to change the color property and leave box-shadow without a color:

box-shadow: 1px 2px 3px;
color: #a00;'

Check out the demo

Support:

  • Safari 6+
  • Chrome 20+ (at least)
  • Firefox 13+ (at least)
  • (IE not tested)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜