CSS组件之图形(figure)

这篇博客详细介绍了如何使用CSS创建各种图形,包括三角形、四边形、多边形、星形、圆形以及特殊形状如爱心、无限大符号等。通过实例展示了CSS clip-path的使用,帮助读者理解并实现这些图形。
摘要由CSDN通过智能技术生成

.container {
   
  width: 150px !important;
  border: 1px solid;
  display: inline-block;
  /* font-size:16px; */
}
.figure {
   
  display: inline-block;
  background-color: black;
}

三角形(triangle)

上三角(triangle-up)

/* clip-path */
.figure.figure-triangle-up {
   
  width: 100%;
  padding-bottom: 100%;
  clip-path: polygon(0 100%, 50% 0, 100% 100%);
}

下三角(triangle-down)

/* clip-path */
.figure.figure-triangle-down {
   
  width: 100%;
  padding-bottom: 100%;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
}

左三角(triangle-left)

/* clip-path */
.figure.figure-triangle-left {
   
  width: 100%;
  padding-bottom: 100%;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

右三角(triangle-right)

/* clip-path */
.figure.figure-triangle-right {
   
  width: 100%;
  padding-bottom: 100%;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

左上角(triangle-topleft)

/* clip-path */
.figure.figure-triangle-topleft {
   
  width: 100%;
  padding-bottom: 100%;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值