How can I correctly add a shadow and a gradient to my triangular shape?

前端 未结 5 759
暗喜
暗喜 2021-01-01 17:59

I want to make the following design:

I tried with :after and :before but it does not work. Here’s my current code:

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-01 18:25

    You can use clip-path as I did. Here is my solution.

    .design {
      background: #ea053a;
      -webkit-clip-path: polygon(50% 0%, 100% 0, 100% 75%, 50% 100%, 0% 75%, 0 0);
      clip-path: polygon(50% 0%, 100% 0, 100% 75%, 50% 100%, 0% 75%, 0 0);
      height: 155px;
      width: 155px;
    }
    
    .month {
      text-align:center;
      padding: 1rem 0 .25rem 0;
      color:#fff;
      font-weight:bold;
      font-size: 18px;
    }
    
    .day {
      text-align: center;
      font-size: 60px;
      font-weight:bold;
      color: #fff;
    }
    Diciembre
    29

提交回复
热议问题