Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • One image changes to another, on hover

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 399
    Comment on it

    Hello, readers.

    This blog post will tell you how to get one image in place of the other on hover. The height and width of the images are 100% and the position is given absolute. Due to this, one image appears behind the other. The second thing to do is changing the opacity of the top image on hover.

    HTML :

    <div id="parentdiv">
        <img class="bottom" src="two.jpg" />
        <img class="top" src="one.jpg" />

    CSS :

    		  margin:0 auto;
    		    border: 0 none;
    		    height: 100%;
    		    width: 100%;
    		    vertical-align: middle;
    		#parentdiv img{
    		     -webkit-transition: opacity 1s ease-in-out;
    		     -moz-transition: opacity 1s ease-in-out;
    		     -o-transition: opacity 1s ease-in-out;
    		     transition: opacity 1s ease-in-out;
    		    cursor: pointer;


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: