clip-path属性怎么在CSS中使用-成都快上网建站

clip-path属性怎么在CSS中使用

clip-path属性怎么在CSS中使用?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

鲁山网站建设公司创新互联公司,鲁山网站设计制作,有大型网站制作公司丰富经验。已为鲁山1000+提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的鲁山做网站的公司定做!

clip-path的使用

polygon

  • 值为多个坐标点组成,坐标第一个值是x方向,第二个值是y方向。

  • 左上角为原点,右下角是(100%,100%)的点。

body {
  background-color: #000;
}

.fa {
  border: 1px solid #fff;
  color: yellowgreen;
  padding: 10px;
  margin: 10px;
}

.fa>div {
  width: 110px;
  height: 110px;
  background-color: yellowgreen;
  margin: 20px auto;
}

.polygon1 {
  clip-path: polygon(50% 0px, 100% 100%, 0px 100%)
}

.polygon2 {
  clip-path: polygon(0px 50%, 50% 0, 100% 50%, 50% 100%)
}

.polygon3 {
  clip-path: polygon(0% 60%, 20% 0%, 60% 0%, 40% 60%)
}

  

polygon

  

值为多个坐标点组成,坐标第一个值是x方向,第二个值是y方向。

  

左上角为原点,右下角是(100%,100%)的点。

  
  
  

clip-path属性怎么在CSS中使用

circle

body {
  background-color: #000;
}

.fa {
  border: 1px solid #fff;
  color: yellowgreen;
  padding: 10px;
  margin: 10px;
}

.fa>div {
  width: 110px;
  height: 110px;
  background-color: yellowgreen;
  margin: 20px auto;
}

.circle1 {
  clip-path: circle(50% at 50% 50%)
}

.circle2 {
  clip-path: circle(70% at 50% 50%)
}

.circle3 {
  clip-path: circle(30% at 10% 10%)
}

  

circle

  

值为一个坐标点和半径组成。

  

左上角为原点,右下角是(100%,100%)的点。

  

定义半径的时候可以用at关键字来定义坐标。

  
     

clip-path属性怎么在CSS中使用

ellipse

body {
  background-color: #000;
}

.fa {
  border: 1px solid #fff;
  color: yellowgreen;
  padding: 10px;
  margin: 10px;
}

.fa>div {
  width: 110px;
  height: 110px;
  background-color: yellowgreen;
  margin: 20px auto;
}

.ellipse1 {
  clip-path: ellipse(30% 20% at 50% 50%)
}

.ellipse2 {
  clip-path: ellipse(20% 30% at 50% 50%)
}

.ellipse3 {
  clip-path: ellipse(60% 10% at 10% 10%)
}

  

ellipse

  

值为椭圆的x轴半径,y轴半径,定位椭圆的坐标三部分组成。

  

左上角为原点,右下角是(100%,100%)的点。

  

at关键字将半径和坐标分开

        

clip-path属性怎么在CSS中使用

inset

值为(上 右 下 左 round 左上角radius 右上角radius 右下角radius 左下角radius)

round前面的数值,表示的是距离,如果第一个值为25%,则表示图像在上面从25%开始绘制。

body {
  background-color: #000;
}

.fa {
  border: 1px solid #fff;
  color: yellowgreen;
  padding: 10px;
  margin: 10px;
}

.fa>div {
  width: 110px;
  height: 110px;
  background-color: yellowgreen;
  margin: 20px auto;
}

.inset1 {
  clip-path: inset(25% 0% 25% 0% round 0% 25% 0% 25%)
}

.inset2 {
  clip-path: inset(0% 25% 25% 0% round 25% 25% 25% 0%)
}

.inset3 {
  clip-path: inset(25% 25% 0% 0% round 0% 25% 0% 25%)
}

  

inset

  

值为(上 右 下 左 round 左上角radius 右上角radius 右下角radius 左下角radius)

  

round前面的数值,表示的是距离,如果第一个值为25%,则表示图像在上面从25%开始绘制

        

clip-path属性怎么在CSS中使用

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。


新闻标题:clip-path属性怎么在CSS中使用
本文链接:http://kswjz.com/article/jcpjeo.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流