【问题标题】:CSS: create material design shadow issueCSS:创建材料设计阴影问题
【发布时间】:2016-11-25 02:32:07
【问题描述】:

我只需要使用 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>

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

【问题讨论】:

标签: html css shadow dropshadow


【解决方案1】:

如果你在 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);
} 

希望这个可行:)

【讨论】:

    【解决方案2】:

    这是你想要的吗?

    .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;
        }  
    <div class="button">
      ADD y activities
    </div>

    【讨论】:

      【解决方案3】:

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

      .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>

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-06-08
        • 2019-04-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多