利用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的伪类的作用还是很多的,可以试试,玩一下

 

转载于:https://www.cnblogs.com/ldlx-mars/p/9951839.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值