how to create on mouse hover effect on image using css3

how to create on mouse hover effect on image using css3

CSS hover effects are always a fun topic to explore. In this tutorial we create some awesome examples of CSS hovers that were easy to copy and paste right into your code.

Now, we are going to follow that up with some new effects specifically built for use with images. Each example comes with an HTML and CSS snippet that you can download source code also using downloading link given below of page.

HTML CODE HERE

<html>
<head>
<title>How to create on mouse hover effect on image using css3 - phpkida.com</title>

</head>
<body>

<ul class="phpkida1 effect1">
    <li>
            <h2>Welcome You Back !</h2>
            <p>Design or develop your website at lowest cost. we providing web designing, Core php , WordPress , E-commerce, Tour And Travels Development Services. <a href="http://www.aapkadeveloper.com">Click Here</a></p>
    </li>
    <li><img class="top" src="http://phpkida.com/phpkida1.png" alt=""/></li>
</ul>



<ul class="phpkida2 effect2">
    <li>
       <h2 class="zero">Welcome You Back !</h2>
       <p class="zero">Design or develop your website at lowest cost.</p>
    </li>
    <li><img class="top" src="http://phpkida.com/phpkida1.png" alt=""/></li>
</ul>

<ul class="demo-3">
    <li>
        <div>
            <img src="http://phpkida.com/phpkida1.png" alt=""/>
            <div>
                <h2>This is a cool title!</h2>
                <p>Design or develop your website at lowest cost. we providing web designing, Core php , WordPress , E-commerce, Tour And Travels Development Services. <a href="http://www.aapkadeveloper.com">Click Here</a></p>
            </div>
        </div>
    </li>
</ul>


</body>
</html>

CSS CODE HERE

<style>
/*********************************
Author: Mukesh Jakhar - PHPKIDA
**********************************/
body {
    background:#ccc;
}


ul {
    margin:20px auto;
    width:30%;
}

ul li {
    display: inline-block;
    list-style: none;
    margin:0 10px;

}

.phpkida1 {
    position:relative;
    width:300px; 
   height:200px;
    overflow:hidden;
    float:left;
    margin-right:20px;
    background-color:rgba(26,76,110,0.5)
}
.phpkida1 p,.phpkida1 h2 {
    color:#fff;
    padding:10px;
    left:-20px;
    top:20px;
    position:relative
}
.phpkida1 p {
    font-family:'Lato';
    font-size:12px;
    line-height:18px;
    margin:0
}
.phpkida1 h2 {
    font-family:'Lato';
    font-size:20px;
    line-height:24px;
    margin:0;
}
.effect1 img {
    position:absolute;
    margin:-15px 0;
    right:0;
    top:0;
    width:340px; 
    height:215px;
    cursor:pointer;
    -webkit-transition:top .4s ease-in-out,right .4s ease-in-out;
    -moz-transition:top .4s ease-in-out,right .4s ease-in-out;
    -o-transition:top .4s ease-in-out,right .4s ease-in-out;
    transition:top .4s ease-in-out,right .4s ease-in-out
}
.effect1 img.top:hover {
    top:-230px;
    right:-330px;
    padding-bottom:200px;
    padding-left:300px
}

/************************ 2nd Effect **********************/
.phpkida2 {
    position:relative;
    width:300px;
    height:200px;
    overflow:hidden;
    float:left;
    margin-right:20px;
    background-color:rgba(26,76,110,0.5)
}
.phpkida2 p,.phpkida2 h2 {
    color:#fff;
    padding:10px;
    left:-20px;
    top:20px;
    position:relative
}
.phpkida2 p {
    font-family:'Lato';
    font-size:12px;
    line-height:18px;
    margin:0
}
.phpkida2 h2 {
    font-size:20px;
    line-height:24px;
    margin:0;
    font-family:'Lato'
}
.effect2 img {
    position:absolute;
    left:0;
    bottom:0;
    cursor:pointer;
    margin:-12px 0;
    width:340px; 
    height:215px;
    -webkit-transition:bottom .3s ease-in-out;
    -moz-transition:bottom .3s ease-in-out;
    -o-transition:bottom .3s ease-in-out;
    transition:bottom .3s ease-in-out
}
.effect2 img.top:hover {
    bottom:-96px;
    padding-top:100px
}
h2.zero,p.zero {
    margin:0;
    padding:0
}


/**************** 3rd Effect ******************/

.demo-3 {
    position:relative;
    width:300px;
    height:200px;
    overflow:hidden;
    float:left;
    margin-right:20px
}
.demo-3 div {
    margin:0;
    padding:0;
    position:relative;
    cursor:pointer;
    margin-left:-50px
}
.demo-3 div img {
    display:block;
    position:relative;
    z-index:10;
    margin:-15px 0
    width:340px; 
    height:215px;
}
.demo-3 div div {
    display:block;
    position:absolute;
    z-index:5;
    -webkit-box-sizing:border-box;
    -moz-box-sizing:border-box;
    box-sizing:border-box
}
.demo-3 div h2 {
    font-family:'Lato';
    color:#fff;
    font-size:20px;
    text-align:left
}
.demo-3 div p {
    display:block;
    font-family:'Lato';
    font-size:12px;
    line-height:18px;
    margin:0;
    color:#fff;
    text-align:left;
    padding:10px 100px 10px 10px;
}
.demo-3 div div {
    top:0;
    left:0;
    width:100%;
    height:100%;
    padding:29px 44px;
    background-color:rgba(26,76,110,0.5);
    text-align:center;
    backface-visibility:hidden;
    -webkit-transform:rotateY(-180deg);
    -moz-transform:rotateY(-180deg);
    transform:rotateY(-180deg);
    -webkit-transition:all .5s;
    -moz-transition:all .5s;
    transition:all .5s
}
.demo-3 div img {
    backface-visibility:hidden;
    -webkit-transition:all .5s;
    -moz-transition:all .5s;
    transition:all .5s
}
.demo-3 div:hover img,div.hover img {
    -webkit-transform:rotateY(180deg);
    -moz-transform:rotateY(180deg);
    transform:rotateY(180deg)
}
.demo-3 div:hover div,div.hover figcaption {
    -webkit-transform:rotateY(0);
    -moz-transform:rotateY(0);
    transform:rotateY(0)
}

</style>

Click on Image and download Source Code of This Tutorial

Download source code of how to create on mouse hover effect on image using css3

I hope you like this tutorial. Share with your friends.

About Author

My name is Mukesh Jakhar and I am a Web Application Developer and Software Developer, currently living in Jaipur, India. I have a Master of Computer Application in Computer Science from JNU Jaipur University. I loves to write on technology and programming topics. Apart from this, I love to travel and enjoy the beauty of nature.

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.