本文摘自PHP中文网,作者不言,侵删。
这篇文章主要为大家详细介绍了Html+CSS绘制三角形图标的相关代码,很多网页都有三角形的图标,通常是切的图片,这里可以用css3+html写出三角形,感兴趣的小伙伴们可以参考一下先看看效果图:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | <!doctype html>
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
< title >Document</ title >
< style type = "text/css" >
#test1 {
height:20px;
width:20px;
border-color:#FF9600 #3366ff #12ad2a #f0eb7a;
border-style:solid;
border-width:20px;
}
#test2 {
height:0;
width:0;
overflow: hidden; /* 这里设置overflow, font-size, line-height */
font-size: 0; /*是因为, 虽然宽高度为0, 但在IE6下会具有默认的 */
line-height: 0; /* 字体大小和行高, 导致盒子呈现被撑开的长矩形 */
border-color:#FF9600 #3366ff #12ad2a #f0eb7a;
border-style:solid;
border-width:20px;
}
#test3 {
height:0;
width:0;
overflow: hidden;
font-size: 0;
line-height: 0;
border-color:#FF9600 transparent transparent transparent;
border-style:solid;
border-width:20px;
}
#test4 {
height:0;
width:0;
overflow: hidden;
font-size: 0;
line-height: 0;
border-color:#FF9600 transparent transparent transparent;
border-style:solid dashed dashed dashed;
border-width:20px;
}/*兼容IE6*/
#test5 {
height:0;
width:0;
overflow: hidden;
font-size: 0;
line-height: 0;
border-color:#FF9600 #3366ff transparent transparent;
border-style:solid solid dashed dashed;
border-width:40px 40px 0 0 ;
}
</ style >
</ head >
< body >
< p id = "test1" ></ p >< br >
< p id = "test2" ></ p >< br >
< p id = "test3" ></ p >< br >
< p id = "test4" ></ p >< br >
< p id = "test5" ></ p >< br >
</ body >
</ html >
|
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP中文网!
相关推荐:
用HTML5
Canvas来绘制三角形和矩形等多边形的方法
使用HTML5和CSS3实现生日蛋糕的制作
以上就是关于Html和CSS绘制三角形图标的方法的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
css border-left-width属性怎么用
Html中src是什么意思
css border-image属性怎么用
Html applet标签是什么意思?Html applet标签的用法详解
Html是干什么的
jsp如何引入css
Html怎么设置字体属性
Html空格代码怎么写
总结Html网页中插入视频的方法
css实现等高布局的三种方式(代码示例)
更多相关阅读请进入《Html》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 关于Html和CSS绘制三角形图标的方法