锦方的个人网页 · 如果有一天你突然想起了我


css 提示

下面是完整的 CSS 提示框示例代码:

<!doctype html>
<html>
<head>
    <style>
         /*---1-------------------------------------------
            	通用
        -------------------------------------------------*/    
        .tooltip{
            position: relative;
            top: 120px;
            display: inline-block;
            border-bottom:1px dotted black;
        }
        /*---2-------------------------------------------
            	这里是上拉文字的
        -------------------------------------------------*/    
       .tooltiptexttop{
            visibility: hidden;
            width:120px;
            background-color: black;
            color:#fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px 0;
            position: absolute;
            z-index: 1;
            bottom: 150%;
            left: 50%;
            margin-left:-60px;
        }
        .tooltip .tooltiptexttop::after{
            content:"";
            position: absolute;
            top: 100%;
            left:50%;
            margin-left: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: black transparent transparent transparent;
        }
        .tooltip:hover .tooltiptexttop{
            visibility: visible;
        }
        /*---3-------------------------------------------
            	这里是左拉文字的
        -------------------------------------------------*/  
        .tooltip .tooltiptextleft{
            visibility: hidden;
            width:120px;
            background-color: black;
            color: #fff;
            text-align: center;
            padding: 5px 0;
            position: absolute;
            z-index: 1;
            top: -5px;
            right: 105%;
        }
        .tooltip:hover .tooltiptextleft{
            visibility: visible;
        }


        /*---4-------------------------------------------
            	这里是下拉文字的
        -------------------------------------------------*/  
        .tooltip .tooltiptextbottom{
            visibility: hidden;
            width: 120px;
            background-color: #000;
            color: white;
            text-align: center;
            border-radius: 6px;
            padding: 5px 0;
            position: absolute;
            z-index: 1;
            top: 100%;
            left:50%;
            margin-left: -60px;
            opacity: 0;
            transition: opacity 1s;
        }
        .tooltip:hover .tooltiptextbottom{
            visibility: visible;
            opacity: 1;
        }


        /*---5-------------------------------------------
            	这里是右拉文字的
        -------------------------------------------------*/  
        .tooltip .tooltiptextright{
            visibility: hidden;
            width:120px;
            background-color: black;
            color: #fff;
            text-align: center;
            border-radius: 6px;
            padding: 5px 0;
            position: absolute;
            z-index: 1;
            top: -5px;
            left: 110%;
        }
        .tooltip .tooltiptextright::after{
            content: "";
            position: absolute;
            top: 50%;
            right: 100%;
            margin-top: -5px;
            border-width: 5px;
            border-style: solid;
            border-color: transparent black transparent transparent;
        }
        .tooltip:hover .tooltiptextright{
            visibility:visible;
        }
    </style>
</head>
<body style="text-align:center;">
    <div class="tooltip">在上面的标签
        <span class="tooltiptexttop">我是不是在上面</span>
    </div></br>
    <div class="tooltip">在左边的标签
        <span class="tooltiptextleft">我是不是在做面</span>
    </div></br>
    <div class="tooltip">在下面的标签
        <span class="tooltiptextbottom">渐渐弹出在下面</span>
    </div></br>
    <div class="tooltip">在右面的标签
        <span class="tooltiptextright">在右面有箭头的</span>
    </div>
</body>
</html>

系列:note

该系列自动来自分类: note

  1. macOS 外置硬盘为什么会出现 ._* 文件
  2. 小众工具软件应该免费、买断还是订阅
  3. 用iPhone和iPad维护Git静态网站可行吗
  4. 一个Mac截图工具,从能截图到能上架还差多远
  5. 重复文件清理工具最危险的不是漏扫,而是误删
  6. 备份dokuwiki数据
  7. grep 命令
  8. zola的Front Matter完整字段的意思
  9. 从dokuwiki切换到quartz
  10. 安装immich记录
  11. 修改dokuwiki时区
  12. macos安装dokuwiki
  13. Debian创建新用户和设置防火墙
  14. mac在Debian安装wireguard和使用
  15. 再也不买不能解bl的手机了
  16. Firefox设置
  17. debian安装FFmpeg来合并youtube音频
  18. css 扩散列表
  19. 两个练习
  20. css RWD
  21. css 图片
  22. css 提示 (当前)
  23. css 下拉
  24. css 表单
  25. css 导航栏
  26. css 单词
  27. HTML SVG
  28. HTML Canvas
  29. HTML input
  30. HTML 结构
  31. 电气施工图说明
  32. china uses dropbox
  33. Nginx installs SSL certificates
  34. debian install shadowsocks
  35. Visual studio code set the python environment
  36. install hexo

下一篇推荐

系列继续阅读

css 下拉