html - How do I add a CSS3 transition to an image overlay? -
i'm trying figure out how give semi-transparent image overlay (that appears on :hover) css3 transition (ease). it's not working. i'm not sure if it's because i'm missing something, or if transitions don't work display property. ideas css workaround (i don't know javascript)? in advance.
relevant html , css:
<div class="thumbnail"> <figure> <img src="images/dude.jpg" alt=""/> </figure> <div class="thumbnail-overlay"> <h2>project name</h2> <h3> skills skills skills</h3> <p>this project description.</p> </div> </div> .thumbnail { position:relative; float:left; width:40%; margin:1.5% 1.5% 0 0; } .thumbnail-overlay { background-color: @dark-gray; display:none; opacity:.9; position:absolute; top:0; left:0; width:100%; height:100%; overflow:hidden; -webkit-transition:all .3s ease; -moz-transition:all .3s ease; transition:all.3s ease; } .thumbnail:hover .thumbnail-overlay { display:block; }
this may you
<div class="tricky"><img class="tricky_image" src="http://distilleryimage11.instagram.com/65c8f832841711e180d51231380fcd7e_7.jpg"></div>
css part:
.tricky { display:inline-block; max-width:200px; max-height:200px; background:red; } .tricky_image { max-width:200px; max-height:200px; -moz-transition: 1s; -webkit-transition: 1s; -ms-transition: 1s; -o-transition: 1s; transition: 1s; opacity:1; filter:alpha(opacity=100); } .tricky_image:hover { opacity:0.2; filter:alpha(opacity=20); }
Comments
Post a Comment