Created
December 7, 2012 11:37
-
-
Save Flipo/4232732 to your computer and use it in GitHub Desktop.
CSS3 Image Zoom on Hover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="wrapper"> | |
<div class="postthumb"> | |
<a> | |
<img src="http://lorempixel.com/222/220/sports"> | |
</a> | |
<div class="title"> | |
<h2>Sample Project</h2> | |
<p> | |
Nam tristique dignissim tincidunt. Praesent | |
mollis, velit ac. | |
</p> | |
</div> | |
</div> | |
<div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.wrapper { | |
width: 222px; | |
margin: 0 auto; | |
padding: 20px; | |
} | |
.postthumb { | |
width: 222px; | |
height: 200px; | |
margin: 0 0 1.25em 1.25em; | |
overflow: hidden; | |
position: relative; | |
text-align: center; | |
-webkit-box-shadow: 1px 1px 2px #e6e6e6; | |
-moz-box-shadow: 1px 1px 2px #e6e6e6; | |
box-shadow: 1px 1px 2px #e6e6e6; | |
cursor: pointer; | |
float: left; | |
} | |
.postthumb .title { | |
width: 222px; | |
height: 200px; | |
position: absolute; | |
overflow: hidden; | |
top: 0; | |
left: 0; | |
background-color: #f8f8f8; | |
-webkit-transition: all 0.3s ease-in-out; | |
-moz-transition: all 0.3s ease-in-out; | |
-o-transition: all 0.3s ease-in-out; | |
-ms-transition: all 0.3s ease-in-out; | |
transition: all 0.3s ease-in-out; | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
} | |
.postthumb img { | |
display: block; | |
position: relative; | |
width: 222px; | |
height: 220px; | |
object-fit: cover; | |
-webkit-transform: scaley(1); | |
-moz-transform: scaley(1); | |
-o-transform: scaley(1); | |
-ms-transform: scaley(1); | |
transform: scaley(1); | |
-webkit-transition: all 0.4s ease-in-out; | |
-moz-transition: all 0.4s ease-in-out; | |
-o-transition: all 0.4s ease-in-out; | |
-ms-transition: all 0.4s ease-in-out; | |
transition: all 0.4s ease-in-out; | |
} | |
.postthumb h2 { | |
text-transform: uppercase; | |
color: #fff; | |
text-align: center; | |
position: relative; | |
font-size: 1em; | |
line-height: 1.5em; | |
padding: 2em 0 0 0; | |
border-bottom: 1px solid rgba(0, 0, 0, 0.3); | |
background: transparent; | |
margin: 1em 1em 0 ; | |
-webkit-transform: scale(0); | |
-moz-transform: scale(0); | |
-o-transform: scale(0); | |
-ms-transform: scale(0); | |
transform: scale(0); | |
color: #333; | |
-webkit-transition: all 0.3s ease-in-out; | |
-moz-transition: all 0.3s ease-in-out; | |
-o-transition: all 0.3s ease-in-out; | |
-ms-transition: all 0.3s ease-in-out; | |
transition: all 0.3s ease-in-out; | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
} | |
.postthumb p { | |
font-family: 'LatoRegular', "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; | |
font-size: 0.75em; | |
position: relative; | |
color: #777777; | |
font-weight: normal; | |
padding: 0; | |
text-align: center; | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
-webkit-transform: scale(0); | |
-moz-transform: scale(0); | |
-o-transform: scale(0); | |
-ms-transform: scale(0); | |
transform: scale(0); | |
-webkit-transition: all 0.3s ease-in-out; | |
-moz-transition: all 0.3s ease-in-out; | |
-o-transition: all 0.3s ease-in-out; | |
-ms-transition: all 0.3s ease-in-out; | |
transition: all 0.3s ease-in-out; | |
} | |
.postthumb:hover img { | |
-webkit-transform: scale(10); | |
-moz-transform: scale(10); | |
-o-transform: scale(10); | |
-ms-transform: scale(10); | |
transform: scale(10); | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; | |
filter: alpha(opacity=0); | |
opacity: 0; | |
} | |
.postthumb:hover .title { | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
cursor: pointer; | |
} | |
.postthumb:hover h2 { | |
-webkit-transform: scale(1); | |
-moz-transform: scale(1); | |
-o-transform: scale(1); | |
-ms-transform: scale(1); | |
transform: scale(1); | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
cursor: pointer; | |
} | |
.postthumb:hover p { | |
-webkit-transform: scale(1); | |
-moz-transform: scale(1); | |
-o-transform: scale(1); | |
-ms-transform: scale(1); | |
transform: scale(1); | |
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; | |
filter: alpha(opacity=100); | |
opacity: 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment