利用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& ...
随机推荐
- windows10安装
https://www.microsoft.com/zh-cn/software-download/windows10
- [No0000CE]检测非空格字符作为密码的密码强度
Regex.Replace(pwd, "^(?:([a-z])|([A-Z])|([0-9])|(.)){6,}|(.)+$", "$1$2$3$4$5").L ...
- Away3D引擎学习入门笔记
(1). 准备工作,一些必须知道的东西 (创建时间:2014-06-05) A.必要的开发语言基础.至少要懂点ActionScript 3.0语法(ActionScript 3.0语法及API参考), ...
- Drying POJ - 3104 二分 最优
题意:有N件湿的衣服,一台烘干机.每件衣服有一个湿度值.每秒会减一,如果用烘干机,每秒会减k.问最少多久可以晒完. 题解:二分.首先时间越长越容易晒完. 其次判定函数可以这样给出:对于答案 X,每一个 ...
- 微信小程序image组件中aspectFill和widthfix模式应用详解
aspectFill 与 widthfix 都是保持宽高比不变 aspectFill 保持纵横比缩放图片,只保证图片的短边能完全显示出来.也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发 ...
- bootstrape学习
bootstrape学习 已分享到有道上:http://note.youdao.com/share/?id=076fb6314c99c742a79f6fb66b2a58b0&type=note ...
- 问题:虚拟环境名字相同遇到bug,please specify a different sdk name?
1.please specify a different sdk name? 这个问题出现的原因是因为PyCharm中存在相同名字的虚拟环境变量. 本人的出错原因是,一直使用PyCharm的默认设置来 ...
- Servlet重写init(ServletConfig config)还是init()
原文地址:Servlet重写init(ServletConfig config)还是init() 写一个Servlet时,有时需要我们重写该Servlet的初始化方法,然后,究竟是重写init(Ser ...
- linux之用户和用户组
什么用户组? 具有某种共同特征的用户集合起来.用户组(Group)配置文件主要有 /etc/group和/etc/gshadow,其中/etc/gshadow是/etc/group的加密信息文件. 注 ...
- 牛客Wannafly9E 组一组 差分约束
正解:差分约束 解题报告: 传送门! 首先肯定要想到把他们分开来考虑,就是说,把数二进制拆分掉,这样就可以分开考虑了嘛 然后考虑设f[i]:前i个数中的1的个数 然后就可以得到一堆差分约束的式子 然后 ...