clip-path 绘制五角星

html 和css代码如下:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
   <div></div>
   <div></div>
</body>
</html>
div {
    position: relative;
    margin: 1em auto;
    width: 18em;
    height: 18em;
    -webkit-filter: drop-shadow(2px 2px 2px #222);
    filter: drop-shadow(4px 4px 5px #777);
}
div:before {
    position: absolute;
    width: inherit;
    height: inherit;
    clip-path: polygon(9em 0em, 10.76336em 6.57295em, 
      17.55951em 6.21885em, 11.85317em 9.92705em, 
      14.29007em 16.28115em, 9em 12em, 
      3.70993em 16.28115em, 6.14683em 9.92705em, 
      0.44049em 6.21885em, 7.23664em 6.57295em);
    content: '';
}
div:nth-of-type(1):before {
    background: conic-gradient(#ff0103 0deg 36deg, #fd7776 36deg 72deg, #ff3133 72deg 108deg, #fa5050 108deg 144deg, #fe9496 144deg 180deg, #fe3030 180deg 216deg, #ff8e8e 216deg 252deg, #fd1b1c 252deg 288deg, #ff757a 288deg 324deg, #fab3af 324deg 360deg);
}
div:nth-of-type(2):before {
    background: conic-gradient(#f1dd0c, #fbed1b, #e0b322, #f9ed1f, #f6eb1f, #d5ad27, #fbe603, #d8ac27, #fae502, #d7ad27, #f1dd0c);
}

收藏:https://www.html.cn/tool/css-clip-path/

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值