码迷,mamicode.com
首页 > Web开发 > 详细

CSS绘制三角形和箭头

时间:2019-09-13 22:18:53      阅读:319      评论:0      收藏:0      [点我收藏+]

标签:display   otto   parent   rgba   width   宽度   abs   tom   line   

三角形

.sanjiaoxing{
position: relative;
top: 3px;
display: inline-block;
margin-left: 8px;
width: 0;
height: 0;
border-width: 5px;  //宽度
border-style: solid;
border-color: #BBBBBB transparent transparent transparent;      //方向
}

 


箭头
.arrTop{
position: absolute;
}
.arrTop:before,.arrTop:after{
position: absolute;
content: ‘‘;
border-top: 8px transparent dashed;
border-left: 8px transparent dashed;
border-right: 8px transparent dashed;
border-bottom: 8px #fff solid;
}
.arrTop:before{
border-bottom:8px rgba(200, 200, 200, 1) solid;
}
.arrTop:after{
top: 1px; /*覆盖并错开1px*/
border-bottom:8px #fff solid;
}

 

 

.arrBottom{
position: absolute;
}
.arrBottom:before,.arrBottom:after{
position: absolute;
content: ‘‘;
border-bottom: 8px transparent dashed;
border-left: 8px transparent dashed;
border-right: 8px transparent dashed;
border-top: 8px #fff solid;
}
.arrBottom:before{
border-top:8px rgba(200, 200, 200, 1) solid;
}
.arrBottom:after{
top: -1px; /*覆盖并错开1px*/
border-top:8px #fff solid;
}

CSS绘制三角形和箭头

标签:display   otto   parent   rgba   width   宽度   abs   tom   line   

原文地址:https://www.cnblogs.com/mrt-yyy/p/11517690.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!