css 边框箭头和三角形写法

<style>
span{padding:0px;margin:0px;line-height: 0px;display: block;}
.bor1{width:500px;height:80px;line-height: 20px;
border-top: 2px solid #EEB422;
       border-right: 2px solid #C0FF3E;
       border-bottom: 2px solid #A020F0;
       border-left: 2px solid #ADB8A3;
}
.bor2{
width: 0;
       height: 0;
       border-top: 20px solid #EEB422;
       border-right: 20px solid #C0FF3E;
       border-bottom: 20px solid #A020F0;
       border-left: 20px solid #ADB8A3;
}
.bor3{
width: 0;
       height: 0;
       border-top: 40px solid #EEB422;
       border-right: 20px solid #C0FF3E;
       border-bottom: 40px solid #A020F0;
       border-left: 20px solid #ADB8A3;
}
.bor4{
width: 0;
       height: 0;        
       border-top: 20px solid transparent;     
       border-bottom: 20px solid transparent;  
       border-left: 20px solid #7CFC00;
}
.bor5{width:0;height:0;
border-top: 20px solid transparent;     
       border-bottom: 20px solid transparent;  
       border-right: 20px solid #7CFC00;
}
.bor6{width:0;height:0;
       border-top: 20px solid #7CFC00;
       border-left: 20px solid transparent;     
       border-right: 20px solid transparent;  
}
.bor7{width:0;height:0;
       border-bottom: 20px solid #7CFC00;
       border-left: 20px solid transparent;     
       border-right: 20px solid transparent;  
}
.bor8{
width:0;height:0;
border-top: 20px solid transparent;
        border-right: 20px solid #C0FF3E;
}
.bor9{
width:0;height:0;
border-top: 20px solid transparent;
        border-left: 20px solid #C0FF3E;
}
.bor10{
width:0;height:0;
border-right: 20px solid transparent;
        border-top: 20px solid #C0FF3E;
}
.bor11{
width:0;height:0;
border-left: 20px solid transparent;
        border-top: 20px solid #C0FF3E;
}
</style>


border边框线的样式并不是长方形的

如上边线放大是一个四边形下窄上宽的,其他边线也是一样的。

这样呢,当宽高都为0时,并显示为块时,样子如下。中心到四边是四边框的宽
四边一样边框会显示正三角形。
上边三角形指向下,下边三角形指向上。正好是相反的指向。

改变边框宽显示会不一样

当把上下边框设置为透明左边框有颜色,左边框会是一个右箭头

当把上下边框设置为透明右边框有颜色,右边框会是一个左箭头

当把左右边框设置为透明上边框有颜色,上边框会是一个下箭头

当把左右边框设置为透明下边框有颜色,下边框会是一个上箭头

border边框显示三角形,方向和边框是相反的
边框的三角形显示和其两邻边有关显必须设置为透明。

右下角三角形:
border-top: 20px solid transparent;
border-right: 20px solid #C0FF3E;

左下角三角形:
border-top: 20px solid transparent;
border-left: 20px solid #C0FF3E;

左上角三角形:
border-right: 20px solid transparent;
border-top: 20px solid #C0FF3E;

右上角三角形:
border-left: 20px solid transparent;
border-top: 20px solid #C0FF3E;

border解析:
任何一边框会影响到其相邻边框的显示:
当上边为0左右边会显示为直角
当右边为0上下边会显示为直角
当下边为0左右边会显示为直角
当左边为0上下边会显示为直角
显示任意连接两边框会显示为正方形,再并其一显示为透明会是一个直角三角形,也就是上右下左
当四边框设置一样的宽,颜色不同。会显示正方形;
如在中心画个十字线,分成八份;
也就是八个直角三角形,也就是二对上下左右方向的三角形;
所以四个角的三角形有两种写法

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值