利用css伪类编写冒泡小三角
HTML代码
<div class="lf otherLogin">
<span>其他方式注册</span>
<div class="otherItem clearfix">
<div class="lf qq">
<img src="./images/login_weibo.png" srcset="./images/login_weibo@2x.png 2x" alt="">
</div>
<div class="lf weibo">
<img src="./images/login_qq.png"srcset="./images/login_qq@2x.png 2x" alt="">
</div>
</div>
</div>
CSS代码
.otherLogin{
padding-left: 26px;
background: -webkit-image-set(url(./../images/login_other.png) 1x,url(./../images/login_other@2x.png) 2x) no-repeat left center;
background: -moz-image-set(url(./../images/login_other.png) 1x,url(./../images/login_other@2x.png) 2x) no-repeat left center;
background: -ms-image-set(url(./../images/login_other.png) 1x,url(./../images/login_other@2x.png) 2x) no-repeat left center;
background: -o-image-set(url(./../images/login_other.png) 1x,url(./../images/login_other@2x.png) 2x) no-repeat left center;
background: image-set(url(./../images/login_other.png) 1x,url(./../images/login_other@2x.png) 2x) no-repeat left center;
background-size: 16px 16px;
margin-left: 10px;
cursor: pointer;
position: relative;
}
.otherItem{
position: absolute;
top: 24px;
right: -76px;
}
.otherItem{
border:1px solid #DFDFDF;
border-radius: 4px;
display: none;
}
.otherLogin:hover .otherItem{
display: block;
}
.otherItem::before,.otherItem::after{
content: '';
position: absolute;
border: solid transparent;
width:0;
height:0;
}
.otherItem::after {
border-width: 5px;
border-right-color: #fff;
top: 10px;
left: -10px;
}
.otherItem::before{
border-width: 6px;
border-right-color: #DFDFDF;
top: 9px;
left:-13px;
}
最后效果图是:

CSS的伪类的作用还是很多的,可以试试,玩一下
利用css伪类编写冒泡小三角的更多相关文章
- 利用css制作带边框的小三角
标签(空格分隔):css 在项目中会使用到的小实例,目前知道的有两种方法来实现 设置元素的宽和高,利用rotate实现,比较简单的一种 div{ width: 10px; height: 10px; ...
- css直接写出小三角
在开发移动端项目时,总是遇到很多小三角,之前一直用图片,感觉好麻烦,今天尝试了直接用CSS写出小三角!先看看如何写出各种小三角! /*箭头向上*/ .arrow-up { ; ; border-lef ...
- 纯css写带小三角对话框
在实际样式中经常会遇到要写类似对话框的样式,而这种样式往往会有一个小三角,如下所示: 那么如何用css写出来呢,其实很简单,先让父元素相对定位,然后运用css的伪类before或after.就可以写个 ...
- 如何用css实线所需要的小三角
使用css实现三角符号 关于使用css制作三角符号,网上有很多的例子了,在这里只是为了详细的向各位解释一下三角符号的原理 下图,是一个长宽为100px,边框宽度为100px的一个元素,由此可见,在cs ...
- 利用css伪类选择器hover控制两个元素属性
示例1: <html> <body> <style> #a:hover {color : #FFFF00;} #a:hover > #b:first-chil ...
- 应用越来越广泛的css伪类
说起css伪类,学习web前端网页设计的同学们应该对此应该不是很陌生,以前很多的网页的特效大多是通过js来实现的.但是随着CSS3不断开发,利用css实现网页的特效不仅响应不错,而且还减少了很多的代码 ...
- 一个常见下拉菜单的样式:一体化小三角(纯css手写解决)
类似下拉菜单2个一体化小三角,习惯上用字体图标加jQuery处理,比较方便,但是下面纯css手写解决方式,效果也还不错,对CSS知识也是一个比较好的孔固. 小三角用了2种不同处理方式:1.利用bord ...
- CSS通过边框border-style来写小三角
<!DOCTYPE html> /*直接复制代码即可在浏览器验证*/ <html> <head lang="en"> <meta char ...
- 用CSS样式写选择框右侧小三角
直接上代码! <!DOCTYPE html><html lang="en"><head> <title>小三角</title& ...
随机推荐
- CH 1602 - The XOR Largest Pair - [字典树变形]
题目链接:传送门 描述在给定的 $N$ 个整数 $A_1, A_2,\cdots,A_N$ 中选出两个进行xor运算,得到的结果最大是多少? 输入格式第一行一个整数 $N$,第二行 $N$ 个整数 $ ...
- python 过滤掉字符串中的回车符与换行符(\t\n)
我们在文本数据预处理前,要将数据统一整理成需要的格式,其中有回车(\t)或者(\n)符号,会对我们的数据保存有影响,那么就需要将其过滤掉. 比较简单的方法,用replace()将这些符号替换为空,一定 ...
- gateone安装使用
下载地址 https://github.com/liftoff/GateOne unzip GateOne-master.zip cd GateOne-master/ python setup.py ...
- Java与面向对象之随感(1)
大一下学期上完了c++课程,当时自我感觉很良好,认为对面向对象编程已经是身经百战了,但是上了院里HuangYu老师的Java课之后,才发现自己对于面向对象的编程风格的理解只在皮毛,着实惭愧不已. 假设 ...
- day0318装饰器和内置函数
一.装饰器 1.装饰器: 解释:装饰器的本事就是一个函数,不改动主代码的情况下,增加新功能.返回值也是一个函数对象. 2.装饰器工作过程 import time def func(): print(' ...
- [skill][c] *(char**)
/* scmp: string compare of *p1 and *p2 */ int scmp(const void *p1, const void *p2) { char *v1, *v2; ...
- java web filter读取classpath配置文件内容
以下demo,从类路径classpath中获取venus.properties(本项目中用到的文件),思路是在初始化的时候读取,然后放在局部变量里面. package club.codeapes.we ...
- gitee 使用
gitee 使用 首先在码云仓库创建对应的仓库 当你输入错误用户名和密码 需要清掉配置 git config --system --unset credential.helper 设置账号 git c ...
- 如何下载网页上的视频和flash的方法
下面介绍一种下载视频的简便方法,这种方法不需要安装任何下载软件,而且适合所有 FLV(Flash Video)格式的视频文件. 第一步 清空Temporary Internet Files(临时网络文 ...
- Java如何循环数组并使用Split
场景: 当写方法时遇到1个参数有3个值, 该参数类型为数组. 例如: aaa|bbb|ccc . 而且需要循环打印,这个时候我们就需要用数组循环输出的方法. 一:feature 示例 Wh ...