Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with hover effect on image

Hello i am trying to create hover effect on img.

HTML

<div>
    <img src="http://placehold.it/350x150"/>
    <div class="link-cont"><a href="#">click here to see more info</a></div>

</div>

css

div {
    width: 350px;
position: relative;    
}
.link-cont {
    background: red;
    position: absolute;
    bottom: 0;
    height: 100px; 
    opacity: 0;
    transition: all 0.4s;
}
div:hover  .link-cont {
    opacity: 1; 
    bottom:-100px;
}

i need a something like this , when the user hover on it image

but i am getting something like this

current

can someone help me to achieve what i am trying to do..

jsFid--> http://jsfiddle.net/Nnd7w/

like image 707
It worked yesterday. Avatar asked Dec 13 '25 23:12

It worked yesterday.


2 Answers

You want like this, check DEMO http://jsfiddle.net/yeyene/Nnd7w/17/

div {
    width: 350px;
    font-size:12px;
    position: relative;    
}
div img{
    padding:0 10px;    
}
.link-cont {
    background: red;
    position: absolute;
    bottom: 0;
    width: 370px;
    height: 210px; 
    opacity: 0;
    transition: all 0.4s;
    z-index: -1
}
div:hover  .link-cont {
    opacity: 1; 
    bottom:-40px;
}
.link-cont a{    
    opacity: 0;  
}
div:hover  .link-cont a{
    position: relative; 
    opacity: 1; 
    bottom:-175px;
    left:10px;
    background:#fff;
    color:red;
    text-decoration:none;
    padding:0 10px;
}
like image 172
yeyene Avatar answered Dec 16 '25 16:12

yeyene


Try this - and let me know if it works for you..

Fiddle

Just a few changes - Could use some cleaning up.

     div {
     position: relative;
     top: 50px;
     background-color: blue;
     width: 350px;
     height: 150px;
     margin: auto;
 }
 .link-cont {
     background: red;
     position: relative;
     left: -50px;
     top: -200px;
     width: 450px;
     height: 250px;
     opacity: 0;
     transition: all 0.4s;
     z-index: -1
 }
 div a {
     position: relative;
     top: 210px;
     left: 50px;
     opacity: 0;
 }
 div:hover .link-cont {
     opacity: 1;
 }
a {
    text-decoration: none;
    color: #fff;
}
 div:hover a {
     opacity: 1;
 }
like image 36
lloan Avatar answered Dec 16 '25 17:12

lloan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!