怎么实现鼠标经过图片在图片上显示文字css

如题所述

<html>
<head>
<style>
#container{position:relative;height:200px;width:300px;border:1px solid red;}
#inss{position:absolute;height:30px;width:300px;}
</style>

<script>
function xianshi(){document.getElementById("inss").style.display="block";}
function yincang(){document.getElementById("inss").style.display="none";}

</script>
<head>
<body>
div代码:
<div id="container" onmouseover="xianshi()" onmouseout="yincang()">
<div id="inss">遮罩层</div>
</div>
</body>
</html>

这个是我做的遮罩层的,和你的需求类似,可以稍作修改,实现你的效果,希望可以帮到你!
温馨提示:答案为网友推荐,仅供参考