我有以下代码:
<!DOCTYPE html> <html >
<head>
<style type="text/css">
.imgBox {background: url(lock75.png) no-repeat; }
.imgBox:hover {background: url(lock75light.png) no-repeat; }
</style>
</head>
<body>
<div style="width:200px; height:200px; border:1px solid;" class="imgBox"> </div>
</body>
</html>
我的图片尺寸为75x75,当我悬停在边框上时,出现了问题,图片会发生改变,我希望在悬停在图片上时改变图片。
注意:我需要一个类似于这个的HTML结构。
编辑:我忘记提到了,我需要把图片居中放置在其他div上方,但没有固定的空间来放置图片。
谢谢。
div
的宽度减小为75px。 - Adam Azad