I have an simple image like this:
<img src="/assets/missing.png">
Now what I want is to be able to hover over the image and have a transparent black overlay appear with a big 'x' on it. Is it possible with CSS3 only or do I need Javascript? And if so how?
I sort of got it to work, but i have an issue that i can't seem to fix. Here's a screenshot:
As you can see there is a part on top missing. Here is my css:
.image {
padding: 0px;
display: inline-block;
vertical-align: middle;
max-height: 150px;
max-width: 150px;
margin: 15px;
position:relative;
}
.image img {
width:100%;
vertical-align:top;
}
.image:after {
content:'\A';
position:absolute;
width:100%; height:100%;
top:0; left:0;
background:rgba(0,0,0,0.6);
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.image:hover:after {
opacity:1;
}