css3伪元素和平移(translate)变换实现的提示框

2018-12-2615:42:23网页制作Comments2,772 views字数 551阅读模式
 <div class="row">
        <a rel="nofollow" rel="noreferrer" href="#" class="btn tooltip top">
            <span>TOOLTIP TOP</span>
            <span class="tooltip-content">Lorem ipsum dolor sit amet</span>
        </a>
    </div>
复制代码
.tooltip .tooltip-content::after {
    background: #05a8ff;
    content: "";
    height: 10px;
    position: absolute;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    width: 10px;
}
.tooltip.top .tooltip-content {
    bottom: calc(100% + 1.5em);
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
}
.tooltip.top .tooltip-content::after {
    bottom: -5px;
    left: 50%;
    margin-left: -5px;
}
复制代码

效果:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9078.html

css3伪元素和平移(translate)变换实现的提示框文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9078.html

作者:codercao文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9078.html

文章源自菜鸟学院-https://www.cainiaoxueyuan.com/zhizuo/9078.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/zhizuo/9078.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定