jiahailiang
div+css画三角形代码原理采用的是均分原理;
在矩形的直角,两条边的样式要均分,把 div 的宽 高设为零,四条边 top right bottom left 设置一个宽度,
把需要显示的一边设置有色,其他的设置透明,就这样一个三角形就出来了

代码如下:

<style>
.box{
  width: 0;
  height:0;
  border-top:50px solid transparent;
  border-right: 50px solid red;
  border-bottom: 50px solid transparent;
  border-left: 50px solid transparent;
}
</style>

<div class="box"></div>

 

分类:

技术点:

相关文章:

  • 2021-12-24
  • 2021-09-27
  • 2021-09-27
  • 2021-10-15
  • 2021-04-10
  • 2021-08-22
  • 2021-09-27
  • 2021-12-29
猜你喜欢
  • 2021-11-30
  • 2021-09-27
  • 2021-09-27
  • 2021-09-27
  • 2021-06-07
  • 2021-09-27
  • 2021-11-17
相关资源
相似解决方案