Skip to content

Instantly share code, notes, and snippets.

@monkeymonk
Last active December 28, 2015 02:29
Show Gist options
  • Save monkeymonk/7428257 to your computer and use it in GitHub Desktop.
Save monkeymonk/7428257 to your computer and use it in GitHub Desktop.
Thumbnail block with image :hover effect (image scale and rotate)
<div class="thumbnails thumbnail-style">
<div class="thumbnail-img">
<div class="overflow-hidden">
<img class="img-responsive" src="http://lorempixel.com/253/160/cats/" alt="" />
</div>
<a class="btn-more" href="#">read more +</a>
</div>
<div class="caption">
<h3><a href="#">Project Two</a></h3>
<p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, justo sit amet risus etiam porta sem.</p>
</div>
</div>
.thumbnail-style {
padding: 5px;
margin-bottom: 20px;
&:hover {
box-shadow: 0 0 8px #ddd;
-webkit-transition: box-shadow 0.2s ease-in-out;
-moz-transition: box-shadow 0.2s ease-in-out;
-o-transition: box-shadow 0.2s ease-in-out;
transition: box-shadow 0.2s ease-in-out;
a {
&.btn-more {
right: 10px;
}
}
.thumbnail-img {
img {
-webkit-transform: scale(1.2) rotate(2deg);
-moz-transform: scale(1.2) rotate(2deg);
-o-transform: scale(1.2) rotate(2deg);
-ms-transform: scale(1.2) rotate(2deg);
transform: scale(1.2) rotate(2deg);
}
}
}
h3 {
margin: 5px 0 0 0;
a {
font-size: 20px;
&:hover {
color: #72c02c;
text-decoration: none;
}
}
}
a {
&.btn-more {
right: -10px;
bottom: 10px;
color: #fff;
padding: 1px 6px;
position: absolute;
background: #72c02c;
display: inline-block;
}
&.btn-more:hover {
text-decoration: none;
box-shadow: 0 0 0 2px #377500;
}
}
.thumbnail-img {
position: relative;
margin-bottom: 10px;
img {
left: 10px;
margin-left: -10px;
position: relative;
-webkit-transition: all 0.8s ease-in-out;
-moz-transition: all 0.8s ease-in-out;
-o-transition: all 0.8s ease-in-out;
-ms-transition: all 0.8s ease-in-out;
transition: all 0.8s ease-in-out;
}
}
} // thumbnail-style
.overflow-hidden {
overflow: hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment