悬停在文本上时显示图像 [英] Display an image while hover on a text

查看:118
本文介绍了悬停在文本上时显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您将鼠标悬停在span标签上时,我试图显示一张图片。我在网上查了一下,但是我发现没有工作。我现在结束了这段代码:

 < span style =display:inline-block;> 
< img class =manImgsrc =_ src / mypicture.jpg>
< / span>

...问题是放置'可移动'文本的位置。当我悬停在该文本上时,它将显示图像。

没有; }
.parent:hover img {display:block; }

示例


I tried to display a picture when you hover on a span-tag. I looked it up on the internet, but what I found didn't work. I now ended up with this code:

<span style="display:inline-block;">
 <img class="manImg" src="_src/mypicture.jpg">
</span>

...and the question is where to put the 'hoverable' text. When I hover on that text it will show the image.

解决方案

img { display: none; }    
.parent:hover img { display: block; }

Example

这篇关于悬停在文本上时显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆