首先HTML布局
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>鼠标悬停</title>
</head>
<body>
<div title="我是鼠标悬停文字">我是一个DIV</div>
</body>
</html>
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/7dd98d1001e939017930a07577ec54e736d1964e?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
悬停文字的问题 , 不用加CSS 给它加个title属性就可以了 , 浏览器会默认有这个样式的,最终显示的图片是
![](https://video.ask-data.xyz/img.php?b=https://iknow-pic.cdn.bcebos.com/eac4b74543a982261475066c8682b9014b90ebc1?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)
css里面,可以把文字显示属性设置为block,然后在鼠标hover时把visiability属性设置为可见,鼠标out时设置visiability设置为不可见就可以了。