10-2·100 css提示工具,鼠标滑过提示文字

 

    

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>提示工具 鼠标滑过提示文字</title>
    <style>
        /* tooltip容器 */
        .tooltip {
            position: relative;
            display: inline-block;
            /*  */
            border-bottom: 1px dotted black;
            /* 悬停元素上显示点线  */
        }

        /* tooltip 文本 */
        .tooltip .tooltipdemo {
            visibility: hidden;
            /* 宽度 */
            width: 120px;
            background-color: black;
            color: #fff;
            text-align: center;
            padding: 5px 0;
            border-radius: 6px;
            /* 定位 */
            position: absolute;
            z-index: 1;
        }

        /* 鼠标移动上去后显示提示框 */
        .tooltip:hover .tooltipdemo {
            visibility: visible;
        }
    </style>
</head>

<body style="text-align: center;">
    <div class="tooltip">鼠标移动到这
        <span class="tooltipdemo">提示文本</span>
    </div>
</body>

</html>

效果

     

 

posted @ 2022-02-09 11:59  优敏行  阅读(321)  评论(0)    收藏  举报