1、实心三角形
<div class="up"></div> <!--向上的三角形-->
<div class="down"></div> <!--向下的三角形-->
<div class="left"></div> <!--向左的三角形-->
<div class="right"></div> <!--向右的三角形-->
/*想获取朝那边三角形,给相反的一边设置颜色,font-size: 0;line-height: 0;可以兼容ie6*/
.up{width: 0;height: 0;border-left: 20px solid transparent;border-right: 20px solid transparent;border-bottom: 20px solid #f00;font-size: 0;line-height: 0;}
.down{width: 0;height: 0;border-left: 20px solid transparent;border-right: 20px solid transparent;border-top: 20px solid #f00;font-size: 0;line-height: 0;}
.left{width: 0;height: 0;border-top: 20px solid transparent;border-right: 20px solid #f00;border-bottom: 20px solid transparent;font-size: 0;line-height: 0;}
.right{width: 0;height: 0;border-top: 20px solid transparent;border-left: 20px solid #f00;border-b

本文介绍了如何使用CSS来创建实心、有边框以及空心三角形的方法,详细讲解了不同类型的三角形实现过程,特别是空心三角形的制作,它是通过对有边框三角形的定位调整来达成的。
最低0.47元/天 解锁文章
775

被折叠的 条评论
为什么被折叠?



