CSS中的路径裁剪样式clip-path

CSS中的路径裁剪样式clip-path

一.概念:

clip-path属性可以防止部分元素通过定义的剪切区域来显示,仅通过显示的特殊区域。

1.【clip-path】

值:
| [ || ] | none

: url()

: inset()
| circle() | ellipse() | polygon()

: fill-box
| stroke-box | view-box | margin-box | border-box | padding-box
| content-box

初始值: none

应用于: 所有元素

继承性:

注释(以上来自ttps://www.cnblogs.com/xiaohuochai/p/7509225.html)

.div1{   height:80px;width:80px; background:yellow;
clip-path:polygon(50%0,35%40%, 0%50%,30%60%, 10%100%, 50%80%, 90%100%,70%60%,100%50%,  65%40%)
      }      
.flag{
 height: 200px; width: 300px; background: red;position:fixed;top:100px;left:618px; border-top-right-radius: 20px; border-bottom-right-radius:20px;
     }     


.flag{
height:200px;width:300px;background:red;position:fixed;top:100px;left:618px;border-top-right-radius:20px;border-bottom-right-radius:20px;
      }
.div1-1,.div1-2,.div1-3,.div1-4{
 height: 50px;
 width: 50px;
 background: yellow;
 clip-path:polygon(
 50% 0,
 35% 40%,
 0% 50%,
 30% 60%,
 10% 100%,
 50% 80%,
 90% 100%,
 70% 60%,
 100% 50%,
 65% 40%
 )  
}
.div1-1{
 position: absolute;
 right: 80px;
 top: 10px;
}
.div1-2{
 position: absolute;
 right: 100px;
 top: 64px;
}
.div1-3{
 position: absolute;
 right: 132px;
 top: 117px;
}
.div1-4{
 position: absolute;
 left: 45px;
 top: 139px;
}
.wood{
 height: 300px;
 width: 2px;
 background: black;
 position: fixed;
 left: 617px;
 bottom: 59px;
}
<body>

<div class="flag">

   <div class="div1"></div>

   <div class="div1-1"></div>

   <div class="div1-2"></div>

   <div class="div1-3"></div>

   <div class="div1-4"></div>

</div>

<div class="wood"></div>

</body>

设置定位和clip-path:polygon()的方法来达到效果,以下为截图
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值