如何使我的图像悬停?
我试图让我的徽标悬停在鼠标悬停上,但它不起作用。我有两张图片上传到我的服务器。这是代码,她是网址。有什么问题吗?
<div id='logo'>
<a href="/index.html">
<img src="/images/logo001H.png" style="display:none">
<img src="/images/logo001.png"
onMouseOver="this.src='/images/logo001H.png'"
onMouseOut="this.src='/images/logo001.png'">
</a>
</div>
#logo {
position:absolute;
text-align:center;
top:20px;
right:10px;
height:150px;
width:150px;
cursor:pointer;
}
I am trying to make my logo hover on mouseover and it is not working. I have two images uploaded to my server. Here is the code and her is the url.What is wrong?
<div id='logo'>
<a href="/index.html">
<img src="/images/logo001H.png" style="display:none">
<img src="/images/logo001.png"
onMouseOver="this.src='/images/logo001H.png'"
onMouseOut="this.src='/images/logo001.png'">
</a>
</div>
#logo {
position:absolute;
text-align:center;
top:20px;
right:10px;
height:150px;
width:150px;
cursor:pointer;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不是 Javascript 专家,但我不会为此使用 Javascript。
尝试以下 CSS:
并删除 img 的...
I'm not a Javascript expert, but I wouldn't use Javascript for this.
Try the following CSS:
And remove the img's...
我建议你使用 css sprites。
http://css-tricks.com/158-css-sprites/
你的html代码将如下所示:
和 css 代码:
您的最终图像将包含两个图像:默认图像和悬停图像。
I propose you use css sprites.
http://css-tricks.com/158-css-sprites/
Your html code will look something like this:
And css code:
Your final image will contain both images: default and hover.