CSS:创建材质设计阴影问题

时间:2016-07-21 13:11:51

标签: html css3 shadow dropshadow

enter image description here

我需要仅使用CSS创建此按钮,并且存在框阴影问题。此按钮上有两个不同的阴影:一个黄色,一个黑色。我得到的最大值是



.button {
  height: 81px;
  width: 250px;
  text-align: center;
  font-family: 'Celias_Medium', 'Open Sans:500', sans-serif;
  font-size: 11px;
  line-height: 3.3;
  letter-spacing: 0.4px;
  cursor: pointer;
  outline: none;
  display: block;
  vertical-align: top;
  padding: 23px 0 26px 0;
  text-transform: uppercase;
  color: #000000;
  background-color: #fbfb5c;
  box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5)
}

<div class="button">ADD 7 Activities</div>
&#13;
&#13;
&#13;

这是result。有没有其他解决方案可以得到这个结果?

3 个答案:

答案 0 :(得分:0)

如果你无法在chrome moz或safari上看到它,请试试这个

.button {
    height: 81px;
    width: 250px;
    text-align: center;
    font-family: 'Celias_Medium', 'Open Sans:500', sans-serif;
    font-size: 11px;
    line-height: 3.3;
    letter-spacing: 0.4px;
    cursor: pointer;
    outline: none;
    display: block;
    vertical-align: top;
    padding: 23px 0 26px 0;
    text-transform: uppercase;
    color: #000000;
    background-color: #fbfb5c;
    box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5);
    -moz-box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5);
    -webkit-box-shadow: 0 20px 90px -30px rgba(251, 251, 92, 0.9), 0 40px 90px -50px rgba(0, 0, 0, 0.5);
} 

希望这个有效:)

答案 1 :(得分:0)

这就是你想要的吗?

&#13;
&#13;
.button {
        height: 81px;
        width: 250px;
        text-align: center;
        font-family: 'Celias_Medium', 'Open Sans:500', sans-serif;
        font-size: 11px;
        line-height: 3.3;
        letter-spacing: 0.4px;
        cursor: pointer;
        outline: none;
        display: block;
        vertical-align: top;
        padding: 23px 0 26px 0;
        box-sizing: border-box;
        text-transform: uppercase;
        color: #000000;
        background-color: #fbfb5c;
        box-shadow: 1px 1px 70px -24px;
    }  
&#13;
<div class="button">
  ADD y activities
</div>
&#13;
&#13;
&#13;

答案 2 :(得分:0)

一般来说,素材按钮看起来像这样,但我真的不知道你在问什么。

.button {
  height: 81px;
  width: 250px;
  text-align: center;
  font-family: Celias_Medium, 'Open Sans:500', sans-serif;
  font-size: 11px;
  line-height: 3.3;
  letter-spacing: .4px;
  cursor: pointer;
  vertical-align: top;
  padding: 23px 0 26px;
  box-sizing: border-box;
  text-transform: uppercase;
  background-color: #fbfb5c;
  border-radius: 4px;
  margin: 16px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .24);
  transition: all .3s cubic-bezier(.25, .8, .25, 1)
}
.button:hover {
  box-shadow: 0 14px 28px rgba(0, 0, 0, .25), 0 10px 10px rgba(0, 0, 0, .22)
}
<div class="button">
  Button no. 1
</div>
<div class="button">
  Button no. 2
</div>
<div class="button">
  Button no. 3
</div>
<div class="button">
  Button no. 4
</div>
<div class="button">
  Button no. 5
</div>