16
How do I make when I hover under an image, another image appears on top with opacity...
For example: I have a div with the cover image of a movie, when I move the mouse under the div, I would like to display the PLAY button.
The only related material I found on the internet was this link that teaches how to show captions under the image, which I adapted to my need.
http://www.kadunew.com/blog/css/mostrar-legenda-ao-passar-o-mouse-sobre-imagens
When I pass the mouse under the image appears the PLAY button...
However, it’s not the way I need it, as the play button appears next to the image when you load the page.
Page loaded without hovering the mouse on the image
Page loaded while hovering the mouse in the image
<style>
.imgefeito{
margin: 0;
overflow: hidden;
float: left;
position: relative;
}
.imgefeito a {
text-decoration: none;
}
.imgefeito a:hover {
cursor: pointer;
}
.imgefeito a:hover .desc{
display: block;
font-size: 1.2em;
padding: 10px 0;
color: #fff;
position: absolute;
bottom: 11px;
padding: 10px;
margin: 0;
}
</style>
<div class="imgefeito">
<a href="#">
<img src="rrr.png" alt="Daim Graffiti" />
<span class="desc">
<img src="play.png" alt="Daim Graffiti" />
</span>
</a>
</div>
Is there a way to use this code correctly, or other simpler and more objective implementation?
@Renan: How so...?
– Charles Fay
Separate where...are already 2 separate images, are you suggesting I put the play outside the div? If it is not working.
– Charles Fay
I edited the question, there are 2 separate images there....... be clearer if that’s not what you mean to say.
– Charles Fay
Now I understand, well...I put the image separates from the button at the end of the question.
– Charles Fay
Wouldn’t it be easier with
onmousemove
set Visible attribute to true?– MarceloBoni