html - Text image link hover -
i'm trying write code shows text on image , i'm trying achieve hover effect. post code @ http://codepen.io/kikibres/pen/lvxmbg can take see how works. can see, when hover on image, darkened, text background isn't affected. likewise, when hover on text background, image effect isn't activated. wanted connect them how? looks might have edit html, think?
html code:
<div class="fourcolumns"> <div class="productpic"> <a href="#"> <img src="http://i.imgur.com/szen19w.png" alt="scuba"> <h2 class="captioncolumn"><span>scuba</span></h2> </a> </div> </div> css code:
.fourcolumns { width: 100%; position: relative; margin: 40px 0;} .productpic { width: 25%; float: left; display: inline-block; position: relative; margin: 0; padding: 0; background-color: #000000;} .productpic { } .productpic img { width: 100%; opacity: 1;} .productpic img:hover { opacity: 0.5;} .productpic .captioncolumn { width: 80%; /*height: 50px;*/ background-color: #ffffff; position: absolute; top: 20px; left: 0; opacity: 1; padding: 5px 0 5px 20px;} .productpic .captioncolumn span { font-family: 'oswald', sans-serif; font-weight: 300; font-size: 36px; position: relative; color: #2a286a; opacity: 1; } .productpic .captioncolumn:hover { opacity: 0.5;}
use .productpic img:hover .productpic .captioncolumn,.productpic img { opacity: 0.5;}
Comments
Post a Comment