纯CSS绘制三角形(多个角度)

来源:互联网 发布:淘宝上传视频要求 编辑:程序博客网 时间:2024/06/06 16:51


运用CSS3绘制三角形的方法

HTML代码:

[html] view plaincopyprint?
  1. <div class="triangle"></div>  
这里的div也可以写span p 等元素替代

1、上三角

 

[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-left: 50px solid transparent;  
  5.   border-right: 50px solid transparent;  
  6.   border-bottom: 100px solid #2894d2;  
  7. }  
2、下三角

[html] view plaincopyprint?
  1. .box{   
  2.   width: 0;  
  3.   height: 0;  
  4.   border-left: 50px solid transparent;  
  5.   border-right: 50px solid transparent;  
  6.   border-top: 100px solid #2894d2;  
  7. }  
3、左三角


[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-top: 50px solid transparent;  
  5.   border-right: 100px solid #2894d2;  
  6.   border-bottom: 50px solid transparent;  
  7. }  
4、右三角


[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-top: 50px solid transparent;  
  5.   border-left: 100px solid #2894d2;  
  6.   border-bottom: 50px solid transparent;  
  7. }  
5、左上三角


[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-top: 100px solid #2894d2;     
  5.   border-right: 100px solid transparent;  
  6. }  
6、右上三角


[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-top: 100px solid #2894d2;    
  5.   border-left: 100px solid transparent;   
  6. }  
7、左下三角


[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-bottom: 100px solid #2894d2;  
  5.   border-right: 100px solid transparent;  
  6. }  
8、右下三角

[html] view plaincopyprint?
  1. .box{  
  2.   width: 0;  
  3.   height: 0;  
  4.   border-bottom: 100px solid #2894d2;  
  5.   border-left: 100px solid transparent;  
  6. }  




转载于:http://blog.csdn.net/ld_____/article/details/48597233

0 0
原创粉丝点击