[英]How to make text appear when hovering over an image that's inside an anchor tag and the anchor tag is inside a div?
i really need help on this. 我真的需要帮助。 I looked everywhere in the web and i tried so many different things and nothing worked for me.
我在网上无处不在,尝试了很多不同的东西,但对我来说却无济于事。 I'm kind of new in programming and maybe this is a newbie question but please help me.
我是编程方面的新手,也许这是一个新手问题,但请帮助我。 I'm trying to make some text appear below one image whenever i pass the mouse over the image.
每当我将鼠标移到图像上方时,我都试图使某些文本出现在图像下方。 I managed to do it with some simple code that i found on the web like this:
我设法用一些在网上找到的简单代码来做到这一点,例如:
CSS CSS
.show {
display: none;
border: 1px solid black;
}
a:hover + .show {display: block;}
HTML HTML
<a><img src="../auxiliar/miniatura-2-inactivo.jpg" width="331" height="331" onmouseover="this.src='../auxiliar/miniatura-2.jpg'" width="331" height="331" onmouseout="this.src='../auxiliar/miniatura-2-inactivo.jpg'" /></a>
<div class="show">Stuff shown on hover</div>
So, this does the trick but, for my specific case i need the anchor tag to be inside of a div, and as soon as i put the anchor tag inside a div tag it just stops showing the text when i hover the image. 因此,这确实可以解决问题,但是,对于我的特定情况,我需要将定位标记放在div内,并且一旦将定位标记放在div标记内,当我将鼠标悬停在图像上时,它就停止显示文本。 Of course I did the changes in CSS like this:
当然,我在CSS中做了如下更改:
CSS CSS
.show {
display: none;
border: 1px solid black;
}
div a:hover + .show {
display: block;
}
HTML HTML
<div>
<a ><img src="../auxiliar/miniatura-2-inactivo.jpg" width="331" height="331" onmouseover="this.src='../auxiliar/miniatura-2.jpg'" width="331" height="331" onmouseout="this.src='../auxiliar/miniatura-2-inactivo.jpg'" /></a>
</div>
<div class="show">Stuff shown on hover</div>
I even tried to add id's and classes to the anchor tag and the div tag to try to reach where i need but i failed. 我什至尝试将id和class添加到anchor标签和div标签中,以尝试到达我需要的位置,但失败了。 I need your help, what can i do?
我需要您的帮助,我该怎么办? Thanks guys
多谢你们
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.