Quantcast
Viewing all articles
Browse latest Browse all 215

IMAGE HOVER EFFECTS USING HTML AND CSS:PHOTO SHRINK EFFECT

Today we are about to see the codes of some sizzling hover effects using HTML and CSS.The hover effects in your site will help you to gain the attention of your visitors easily to any important images or banner in your sites.The choosing of images for this effect should be right to make this effect stunning See the Demo effect of image shrinking here.We have added the codes for zooming and panning image at previous post Zoom hover effect


CODES:

FRAME AROUND YOUR IMAGE:
The below CSS code will add frame around your image and limit your image effects within the frame and does not disturb the other elements in your webpage.

  1. <style type="text/css">
  2. .pic {
  3. border: 10px solid #fff; 
  4. float: left;
  5. height: 300px;
  6.   width: 300px;
  7.   margin: 20px;
  8. overflow: hidden;
  9. -webkit-box-shadow: 5px 5px 5px #111;
  10.    box-shadow: 5px 5px 5px #111; 
  11. }
  12. </style>
  13. <div class="pic">
  14. <img src="http://......"></img>
  15. </div>
SHRINK EFFECT:
This code will shrink the image when you hover it.
  1. .shrink img { 
  2. height: 400px;
  3. width: 400px;
  4. -webkit-transition: all 1s ease;
  5. -moz-transition: all 1s ease;
  6. -o-transition: all 1s ease;
  7. -ms-transition: all 1s ease;
  8. transition: all 1s ease;
  9.                     }
  10. .shrink img:hover {
  11.  width: 300px;
  12.  height: 300px;
  13.                              }
  14. <div class="shrink pic">
  15.  <img src="........"></img>
  16. </div>
The class "shrink pic" in the <div> tag adds the CSS properties of both Shrink and pic calss there you obtain a image with shrinking effect inside the frame. 
    WITHOUT FRAMES:
    The usage of frames gives many advantages but for those who need their image to shrink and without any frame around the image you can use the following code but be aware that this may disturb the elements near the image.So i suggest to use it with caution.
    1.  To do so replace the first line of the above Shrink effect code ".Shrink img" with "img.Shrink"
    2. Then replace the 10th line ".shrink img:hover" with "img.shrink:hover"
    3. Then all you have to do is remove the <div> tag and define the class "shrink" inside the <img> tag. 
    4. Your <img> tag will looks like this after this modifications
                    <img class="shrink" src="......."></img>
    Post your queries and comments on this code.More codes to be added soon keeping visiting our site.

        
      Image may be NSFW.
      Clik here to view.

      Viewing all articles
      Browse latest Browse all 215

      Trending Articles