css实现实心三角形、有边框的三角形和空心三角形

本文介绍了如何使用CSS来创建实心、有边框以及空心三角形的方法,详细讲解了不同类型的三角形实现过程,特别是空心三角形的制作,它是通过对有边框三角形的定位调整来达成的。
摘要由CSDN通过智能技术生成

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值