首页 > 代码库 > css span提示框 练习(不能用div)

css span提示框 练习(不能用div)

<!DOCTYPE html><html><head>    <title></title>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>    <link href="style/style.css" rel="stylesheet" type="text/css"/>    <script type="text/javascript" src="js.js"></script>    <style type="text/css">    </style>    <script type="text/javascript">    </script></head><body><div>    <h1>上下文增加内容,方便测试位移</h1>    <p>增加内容方便测试位移:鼠标<a href="#">悬浮<span>鼠标悬浮提示鼠标悬浮提示鼠标悬浮提示鼠标悬浮提示鼠标悬浮提示</span></a>提示练习测试</p>    <h2>上下文增加内容,方便测试位移</h2></div></body></html>

 

span{    display: none;}a{    text-decoration: none;    font-weight: bold;    color: red;    position: relative;}a:hover span{    border: 1px solid black;    display: block;    position: absolute;    background: #ffffff;    width:120px;    height: 120px;    margin:4px 0 0 10px;    padding:8px;}