pure CSS3 实现三角形icon的方法
pure CSS3 实现三角形icon的方法
border: color+transparent
transform : rotate() /rotateZ()
? 使用 实体字符”◆“实现三角形效果
demo:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
-webkit-overflow-scrolling: touch;
}
.container{
margin-left: 300px;
margin-top: 200px;
}
.box{
width:60px;
height:60px;
/*border: 1px solid #0f0;*/
float: left;
position: relative;
}
.b1{
background: #e66161;
}
.b1 .circle{
width: 10px;
height: 10px;
background: #fff;
position: absolute;
border-radius: 5px;
top: 25px;
left: 60px;
z-index: 9999;
}
.triangle{
width:0px;
height:0px;
border-width:30px;
border-style:solid;
/*border-color:#e66161 #f3bb5b #94e24f #85bfda;*/
border-color:transparent transparent transparent #e66161;
/*can not using border-radius, head is not the real triangle*/
}
</style>
</head>
<body>
<div>
<h1>-webkit-overflow-scrolling: touch;</h1>
</div>
<div class="container">
<div class="box b1">
<div class="circle">
<!-- -->
</div>
</div>
<div class="box">
<div class="triangle">
<!-- -->
</div>
</div>
</div>
</body>
</html>
label Icon + font
1
demo-update:
1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
*{
-webkit-overflow-scrolling: touch;
}
.container{
margin-left: 300px;
margin-top: 200px;
background-color: #000;
width: auto;
height: auto;
overflow: hidden;
}
.box{
width:60px;
height:60px;
/*border: 1px solid #0f0;*/
float: left;
position: relative;
border-radius: 7px 0 0 7px;
}
.b1{
background: #2CCD76;
}
.b1 .circle{
width: 10px;
height: 10px;
background: #fff;
position: absolute;
border-radius: 5px;
top: 25px;
left: 60px;
z-index: 9999;
}
.b1 span{
color: #fff;
font-size: 1.5em;
display: inline-block;
/*text-align: center;*/
/*justify-content: center;*/
/*border: 1px solid red;*/
margin: 25% 8.3%;
}
.triangle{
width:0px;
height:0px;
border-width:30px;
border-style:solid;
/*border-color:#e66161 #f3bb5b #94e24f #85bfda;*/
border-color:transparent transparent transparent #2CCD76;
/*can not using border-radius, head is not the real triangle*/
}
</style>
<style>
.r-container{
margin-left: 300px;
margin-top: 10px;
background-color: #000;
width: auto;
height: auto;
overflow: hidden;
}
.r-box{
width:60px;
height:60px;
/*border: 1px solid #0f0;*/
float: left;
position: relative;
border-radius: 10px 7px 7px 10px;
background: #2CCD76;
z-index: 9999;
}
.r-box span{
color: #fff;
font-size: 1.5em;
display: inline-block;
/*text-align: center;*/
/*justify-content: center;*/
/*border: 1px solid red;*/
margin: 25% 8.3%;
}
.rr{
width:42.5px;
height:42.5px;
/*border: 1px solid #0f0;*/
float: left;
left: 35px;
top: 9px;
position: absolute;
background: #2CCD76;
transform: rotateZ(45deg);
/* rotate center ???*/
z-index: -1;
border-radius: 3px 5px;
}
.rr .rc{
width: 10px;
height: 10px;
background: #fff;
position: absolute;
border-radius: 5px;
top: 10px;
left: 22px;
}
</style>
</head>
<body>
<div>
<h1>-webkit-overflow-scrolling: touch;</h1>
</div>
<div class="container">
<div class="box b1">
<span>DEMO</span>
<div class="circle">
<!-- -->
</div>
</div>
<div class="box">
<div class="triangle">
<!-- -->
</div>
</div>
</div>
<hr>
<div class="r-container">
<div class="r-box">
<span>DEMO</span>
<div class="rr">
<div class="rc">
<!-- -->
</div>
</div>
</div>
</div>
</body>
</html>
1
1
1
1
1
1
1
1
pure CSS3 实现三角形icon的方法的更多相关文章
- css3画三角形的原理
以前用过css3画过下拉菜单里文字后面的“下拉三角符号”,类似于下面这张图片文字后面三角符号的效果 下面是一个很简单的向上的三角形代码 #triangle-up { width: 0; height: ...
- CSS3中新颖的布局方法
本人已经很久没用 bootstrap 什么的了,而现阶段一点卑微的梦想就是自己做框架,毕竟也才入门不久. 所以在寻找布局的共通性/稳定性及拓展性时,会发觉 CSS3 的这三种方法比栅栏布局要有趣得多. ...
- css3 input placeholder颜色修改方法
css3 input placeholder颜色修改方法<pre> input::-webkit-input-placeholder { /* placeholder颜色 */ color ...
- css3自定义上传图片输入框的方法
css3自定义上传图片输入框的方法 代码如下<pre> <form class="form1"> <img src="/kelatoupia ...
- js 获取和设置css3 属性值的实现方法
众多周知 CSS3 增加了很多属性,在读写的时候就没有原先那么方便了. 如:<div style="left:100px"></div> 只考虑行间样式的话 ...
- RETINA显示屏下ICON优化方法
便于理解,先来了解几个名词: dpi(dots per inch),每英寸的点数,用来测量任何设备的硬件分辨率.一个21”的屏幕可以拥有1680 X 1050 的分辨率,27”的屏幕也可以拥有相同的分 ...
- xcode 5.0 以上去掉icon高亮方法&iOS5白图标问题
之前的建议方法是把在xxx.info.plist文件中把 icon already includes gloss and bevel effects 设置YES 在Xcode5下,反复实现不成功,今天 ...
- 让IE6IE7IE8支持CSS3属性的8种方法介绍
我们都知道,IE浏览器暂不支持CSS3的一些属性.国外的工程师们,不安于此现状,他们总是尽量使用一些手段使IE浏览器也能支持CSS3属性,我觉得这些都是很有意义,很有价值的工作,可以推动整个技术领域的 ...
- CSS3画三角形原理
1.首先看一下画出一个下三角形完整的代码及效果图 #trangle1-up{ width:; height:; border-left:50px solid transparent; border-r ...
随机推荐
- JMeter去掉启动的cmd命令窗口和制作快捷方式
1.去掉启动的cmd命令窗口 在使用jmeter时,如果使用默认的jmeter.bat启动的话,会出现一个CMD命令窗口,之后才会启动jmeter工作界面: 如果直接启用ApacheJMeter.ja ...
- Python+Selenium+Unittest实现PO模式web自动化框架(6)
1.TestCases目录下的模块 TestCases目录下是存放测试用例的目录. TestCases目录下的测试用例采用unittest框架来构建. 例如:登录功能的测试用例.(test_1_log ...
- jmeter进行分布式压测过程与 注意事项
jmeter命令行运行但是是单节点下的, jmeter底层用java开发,耗内存.cpu,如果项目要求大并发去压测服务端的话,jmeter单节点难以完成大并发的请求,这时就需要对jmeter进行分布式 ...
- Tensorflow-交叉熵&过拟合
交叉熵 二次代价函数 原理 缺陷 假如我们目标是收敛到0.A点为0.82离目标比较近,梯度比较大,权值调整比较大.B点为0.98离目标比较远,梯度比较小,权值调整比较小.调整方案不合理. 交叉熵代价函 ...
- 解决window10 和 ubuntu 双系统安装没有启动选项问题
win10 和Ubuntu 双系统安装在网上已经有很多例子了,这里就不在赘述了. 今天新买的笔记本,想安装双系统.正常安装完ubuntu 重启后没有选项. 解决方法一 下载和解压以后,按照以下的步骤安 ...
- (007)每日SQL学习:将字符和数字分离
with aa as ( select 'sad10' as data from dual union all select 'datf20' as data from dual union all ...
- var、let、const之间的区别
var声明变量可以重复声明,而let不可以重复声明var是不受限于块级的,而let是受限于块级var会与window相映射(会挂一个属性),而let不与window相映射var可以在声明的上面访问变量 ...
- OAuth2.0与前端无感知token刷新实现
前言 OAuth是一个关于授权(authorization)的开放网络标准,在全世界得到广泛的应用.Facebook.Twitter和Google等各种在线服务都提供了基于OAuth规范的认证机制. ...
- Excel三个下拉互斥
Excel三个下拉互斥 描述:Excel有三个下拉列表,若选择了其中任意一个下拉,其他两个均不可以在选择. 尝试了很多种办法,级联,数据有效性等等,最后都没实现. 老大,最后用VBA实现. 附上代码: ...
- java 将内容写入文件 txt
@Test //将内容写入文件 public void xieru() throws Exception{ FileWriter fileWriter=new FileWriter("d:\ ...