zoukankan      html  css  js  c++  java
  • css3 +data属性实现提示框

    a { 
        border-bottom:1px solid #bbb;
        color:#666;
        display:inline-block;
        position:relative;
        text-decoration:none;
    }
    a:hover,
    a:focus {
        color:#36c;
    }
    a:active {
        top:1px; 
    }
     
    /* Tooltip styling */
    a[data-tooltip]:after {
        border-top: 8px solid #222;
        border-top: 8px solid hsla(0,0%,0%,.85);
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        content: "";
        display: none;
        height: 0;
        width: 0;
        left: 25%;
        position: absolute;
    }
    a[data-tooltip]:before {
        background: #222;
        background: hsla(0,0%,0%,.85);
        color: #f6f6f6;
        content: attr(data-tooltip);
        display: none;
        font-family: sans-serif;
        font-size: 14px;
        height: 32px;
        left: 0;
        line-height: 32px;
        padding: 0 15px;
        position: absolute;
        text-shadow: 0 1px 1px hsla(0,0%,0%,1);
        white-space: nowrap;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
        -o-border-radius: 5px;
        border-radius: 5px;
    }
    a[data-tooltip]:hover:after {
        display: block;
        top: -9px;
    }
    a[data-tooltip]:hover:before {
        display: block;
        top: -41px;
    }
    a[data-tooltip]:active:after {
        top: -10px;
    }
    a[data-tooltip]:active:before {
        top: -42px;
    }
    <a href="aasd" data-tooltip="niasdasdasdahao">asdasdasdasdas</a>

    效果图:

  • 相关阅读:
    第一次实验
    pta12
    《暗时间》读书笔记
    案例分析
    软件工程第二次作业
    阅读任务
    20210311_软工_准备工作
    学习总结
    第十四周学习总结&实验报告
    第十三周课程总结
  • 原文地址:https://www.cnblogs.com/xzma/p/7605220.html
Copyright © 2011-2022 走看看