css实现三角形形状
2016-01-20 16:43
489 查看
<div class="arrow-up">
<!--向上的三角-->
</div>
<div class="arrow-down">
<!--向下的三角-->
</div>
<div class="arrow-left">
<!--向左的三角-->
</div>
<div class="arrow-right">
<!--向右的三角-->
</div>
下面用CSS3分别实现向上、下、左、右的三角形
/*箭头向上*/
.arrow-up {
width:0;
height:0;
border-left:30px solid transparent;
border-right:30px solid transparent;
border-bottom:30px solid #fff;
}
/*箭头向下*/
.arrow-down {
width:0;
height:0;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-top:20px solid #0066cc;
}
/*箭头向左*/
.arrow-left {
width:0;
height:0;
border-top:30px solid transparent;
border-bottom:30px solid transparent;
border-right:30px solid yellow;
}
/*箭头向右*/
.arrow-right {
width:0;
height:0;
border-top:50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid green;
}
<!--向上的三角-->
</div>
<div class="arrow-down">
<!--向下的三角-->
</div>
<div class="arrow-left">
<!--向左的三角-->
</div>
<div class="arrow-right">
<!--向右的三角-->
</div>
下面用CSS3分别实现向上、下、左、右的三角形
/*箭头向上*/
.arrow-up {
width:0;
height:0;
border-left:30px solid transparent;
border-right:30px solid transparent;
border-bottom:30px solid #fff;
}
/*箭头向下*/
.arrow-down {
width:0;
height:0;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-top:20px solid #0066cc;
}
/*箭头向左*/
.arrow-left {
width:0;
height:0;
border-top:30px solid transparent;
border-bottom:30px solid transparent;
border-right:30px solid yellow;
}
/*箭头向右*/
.arrow-right {
width:0;
height:0;
border-top:50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 50px solid green;
}
相关文章推荐
- CSS代码重构与优化之路
- CSS代码重构与优化之路
- html,css记录
- css之clearfix清除浮动
- 关于input的placeholder的样式设置问题,兼容多种浏览器
- --css 控制文字多使用省略号
- css实现鼠标滑过五角星高亮效果
- CSS fon属性
- 12个css高级技巧汇总
- 各大浏览器 CSS Hack 收集
- 手机web——自适应网页设计(html/css控制)
- 安卓中编写样式的xml文件的用法
- CSS
- CSS3 彩虹背景
- css3 animation一些很有用的属性和方法
- CSS3渐变
- CSS学习总结
- CSS学习摘记
- css padding在ie7、ie6、firefox中的兼容问题
- CSS总结