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

前端 未结 5 776
暗喜
暗喜 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:28

    Here is my solution to add shadow and gradient to the shape

    .design {
      background: #ea053a;
      display: inline-block;
      height: 155px;
      margin-left: 33px;
      margin-right: 40px;
      position: relative;
      width: 228px;
      filter: drop-shadow(0 1px 10px rgba(0, 0, 0, 0.8));
     
    }
    
    .triangle {
      position: absolute;
      height: 100px;
      top: 155px;
      width: 228px;
      -webkit-clip-path: polygon(49% 44%, 0% 100%, 100% 100%);
      clip-path: polygon(49% 44%, 0% 100%, 100% 100%);
      background-color: #ea053a;
      transform: rotate(180deg);
      
    }

提交回复
热议问题