Quantcast
Viewing all articles
Browse latest Browse all 215

SWIPING IMAGE HOVER EFFECTS USING HTML AND CSS

Image hover effects using simple HTML and CSS used widely in all websites to attract visitors. In my blog i have posted wide variety of articles based on Image hover effects and you can view all of them in this Demo effects page.Note that some of the effects in that page will not work due to blogger template but it will work 100% if you implement it separately. This post was all about swiping image hover effects using simple CSS  programming.The idea behind this was using a background image below the original image and swipe it when hover and display the background image.Lets move into the coding part of this Hover effect.


CSS:
  1. .pic {
  2. border: 10px solid #fff;  
  3. float: left;
  4. height: 300px;
  5. width: 300px;
  6. margin: 10px;
  7. overflow: hidden;
  8. -webkit-box-shadow: 5px 5px 5px #111;
  9. box-shadow: 5px 5px 5px #111;  
  10. }
  11. .swip{
  12. background: url("Your background image URL");
  13. background-size:300px 300px;
  14. display: inline;
  15. }
  16. .swip img{
  17. margin-left: 0 px;
  18. -webkit-transition: margin 2s ease;
  19. -moz-transition: margin 2s ease;
  20. -o-transition: margin 2s ease;
  21. transition: margin 2s ease;
  22. }
  23. .swip img:hover{
  24. margin-left: -300px;
  25. }
The above CSS coding comprises of two parts the class ".Pic" was used to provide the border box around the image and  to avoid the overflow of the image when hovered.The next ".Swip" was the main part of the coding  which defines a background image and causes the original image to swipe left when the mouse hovers the image.

HTML PART:
  1. <div class="swip pic">
  2. <img width="300" height="300" src="Original Image URL">
  3. </img>
  4. </div>
The HTML part of this coding was very simple and its sole purpose is to define both the ".Pic" and ".Swip" classes in a <div> tag to apply the both the class properties to the image.And that's it with the coding very easy isn't it? and now your image is ready to be swiped.

Hope this post will be useful to you and don't forget to post your opinions and queries regarding this post.Share this post with others through social networks if you love it.
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 215

Trending Articles