核心:
1.获取光标当前坐标位置
2.将当前坐标位置赋值给提示信息块
HTML
- 定义一个大盒子,里面一个p标签放提示信息
<div class="box1">
<p class="box2">提示信息</p>
</div>
CSS
<style>
* {
padding: 0;
margin: 0;
}
.box1 {
width: 400px;
height: 400px;
background-color: rgb(198, 147, 247);
position: relative;
margin: auto;
}
.box2 {
width: 100px;
height: 50px;
line-height: 50px;
text-align: center;
color: white;
background-color: rgb(183, 248, 145);
position: absolute;
pointer-events: none;
}
</style>
<