博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
纯CCS绘制三角形箭头图案
阅读量:4630 次
发布时间:2019-06-09

本文共 1360 字,大约阅读时间需要 4 分钟。

用CSS绘制三角形箭头。使用纯CSS,你只需要很少的代码就可以创作出各种浏览器都兼容的三角形箭头!

 

CSS代码:

/* create an arrow that points up */div.arrow-up {	width: 0; 	height: 0; 	border-left: 5px solid transparent;  /* left arrow slant */	border-right: 5px solid transparent; /* right arrow slant */	border-bottom: 5px solid #2f2f2f; /* bottom, add background color here */	font-size: 0;	line-height: 0;}/* create an arrow that points down */div.arrow-down {	width: 0; 	height: 0; 	border-left: 5px solid transparent;	border-right: 5px solid transparent;	border-top: 5px solid #2f2f2f;	font-size: 0;	line-height: 0;}/* create an arrow that points left */div.arrow-left {	width: 0; 	height: 0; 	border-bottom: 5px solid transparent;  /* left arrow slant */	border-top: 5px solid transparent; /* right arrow slant */	border-right: 5px solid #2f2f2f; /* bottom, add background color here */	font-size: 0;	line-height: 0;}/* create an arrow that points right */div.arrow-right {	width: 0; 	height: 0; 	border-bottom: 5px solid transparent;  /* left arrow slant */	border-top: 5px solid transparent; /* right arrow slant */	border-left: 5px solid #2f2f2f; /* bottom, add background color here */	font-size: 0;	line-height: 0;}

绘制这些三角形的关键在于,你要让箭头所指方向的两个侧边有很粗的边框。而背向箭头方向的一边也是同样粗的边框,而这条边的颜色就是你的三角形的颜色。边框越粗,三角形越大。用这种方法你可以绘制出各种颜色、各种大小、各种朝向的箭头。最妙的是,你只需要几行CSS代码就能实现这种效果。

 

转载于:https://www.cnblogs.com/harlem/p/6024767.html

你可能感兴趣的文章
【转】html树形菜单控件
查看>>
C# winform 弹框提示内存不足
查看>>
ZYJ_MainActivity
查看>>
Struts2框架的常量属性及包含其他配置文件
查看>>
weiphp 投票插件的主控制器部分代码
查看>>
ZOJ--1610-Count the Colors
查看>>
资源 | 普通程序员如何自学机器学习
查看>>
如何判断一个数是否为素数
查看>>
基本控件学习以( RadioGroup和RadioButton 的学习使用)
查看>>
Test Scenarios for Excel Export functionality
查看>>
5月3日上课笔记-XML解析
查看>>
【嵌入式开发】Raspberry Pi 树莓派性能测试
查看>>
【Qt开发】设置Qt应用程序图标
查看>>
CentOS 6.2 安装kdbg
查看>>
libevent源码分析:event_assign、event_new
查看>>
a new start in cnblogs
查看>>
luogu 2216 理想的正方形 单调队列(其实没有DP)
查看>>
在控制台应用程序下,创建窗口,避开WinMain函数入口
查看>>
最大连续子数组和--dp
查看>>
英文词频统计预备,组合数据类型练习
查看>>