jcadima
10/25/2016 - 7:42 PM

Black Transparency on image hover

Black Transparency on image hover


more example:
http://stackoverflow.com/questions/18322548/black-transparent-overlay-on-image-hover-with-only-css

http://jsfiddle.net/9z26ky19/


<div class="image">
    <img src="http://i.stack.imgur.com/Sjsbh.jpg" alt="" />
</div>



<style>
  
.image {
    position:relative;
    width:400px;
    height:400px;
}
.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;
}  
  
</style>