html5 - Creating a Zoom Effect on an image on hover using CSS? -


i'm trying create zoom effect on hover on 1 of 4 images. problem examples use tables or mask divs apply sort of effect.

here's 1 example implements this.

this code far.

thanks much!!

html

<div id="menu"> <img class ="blog" src="http://s18.postimg.org/il7hbk7i1/image.png" alt=""> <img class ="music" src="http://s18.postimg.org/4st2fxgqh/image.png" alt=""> <img class ="projects" src="http://s18.postimg.org/sxtrxn115/image.png" alt=""> <img class ="bio" src="http://s18.postimg.org/5xn4lb37d/image.png" alt=""> </div> 

css

#menu {     max-width: 1200px;     text-align: center;     margin: auto; }  #menu img {     width: 250px;     height: 375px;     padding: 0px 5px 0px 5px;     overflow: hidden;  }   .blog {     height: 375px;     -webkit-transition: 1s ease;     -moz-transition: 1s ease;     -o-transition: 1s ease;     -ms-transition: 1s ease;     transition: 1s ease; }  .blog:hover {     cursor: pointer;     height:475px;     width: 350px; }  .music {     height: 375px; }  .projects {     height: 375px; }  .bio {     height: 375px; } 

what using css3 transform property , use scale ill give zoom effect, can done so,

html

<div class="thumbnail">     <div class="image">         <img  src="http://placehold.it/320x240" alt="some awesome text"/>     </div> </div> 

css

.thumbnail {     width: 320px;     height: 240px; }  .image {     width: 100%;     height: 100%;     }  .image img {     -webkit-transition: 1s ease; /* safari , chrome */     -moz-transition: 1s ease; /* firefox */     -ms-transition: 1s ease; /* ie 9 */     -o-transition: 1s ease; /* opera */     transition: 1s ease; }  .image:hover img {     -webkit-transform:scale(1.25); /* safari , chrome */     -moz-transform:scale(1.25); /* firefox */     -ms-transform:scale(1.25); /* ie 9 */     -o-transform:scale(1.25); /* opera */      transform:scale(1.25); } 

here's demo fiddle. removed of element make simpler, can add overflow hidden .image hide overflow of scaled image.

zoom property works in ie


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -