This question is pretty simple, but I can't seem to find a solution. I have a profile image which I want to become tinted on hover. As you can see in the snippet, it works, however only when the image isn't visible. It is a local image, so I have intentionally shown an example of the image being there and not being there. Any thoughts?
.box {
width:100px;
height:100px;
border:1px solid grey;
display: inline-block;
vertical-align: top;
margin-top: 10px;;
}
.overlay {
position: relative;
}
.overlay:after {
position: absolute;
content:"";
top:0;
left:0;
width:100%;
height:100%;
opacity:0;
background-color: orange;
}
.overlay:hover:after {
opacity: .5;
}
<img onclick="sendMessage1()" id="picture1" src="static/images/richie.jpg" class="box overlay">
In this snippet, a web image is used to show what I mean.
.box {
width:100px;
height:100px;
border:1px solid grey;
display: inline-block;
vertical-align: top;
margin-top: 10px;;
}
.overlay {
position: relative;
}
.overlay:after {
position: absolute;
content:"";
top:0;
left:0;
width:100%;
height:100%;
opacity:0;
background-color: orange;
}
.overlay:hover:after {
opacity: .5;
}
<img onclick="sendMessage1()" id="picture1" src="https://www.thoughtco.com/thmb/HBaobb2gkXAlGq-a6K56PeyaLOg=/768x0/filters:no_upscale():max_bytes(150000):strip_icc()/clouds-5b6b4e50c9e77c0050491212.jpg" class="box overlay">