Skip to content

Instantly share code, notes, and snippets.

@kalimar
Created September 25, 2014 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalimar/80ee204b731e3543d77f to your computer and use it in GitHub Desktop.
Save kalimar/80ee204b731e3543d77f to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
<div class='grid'>
<div class='photo'>
<img src="http://www.customink.com/photos/system/images/39331/large/931213063.JPG?1410820504"/>
</div>
<div class='photo'>
<img src='http://www.customink.com/photos/system/images/28263/large/image.jpg?1392311502'/>
</div>
</div>
// ----
// Sass (v3.4.4)
// Compass (v1.0.1)
// ----
.photo {
position: relative;
width: 200px;
height: 200px;
overflow:hidden;
margin: 0 auto;
}
img {
position: absolute;
left: 50%;
top: 50%;
height: 100%;
width: auto;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-transform: translate(-50%, -50%);
}
.photo {
position: relative;
width: 200px;
height: 200px;
overflow: hidden;
margin: 0 auto;
}
img {
position: absolute;
left: 50%;
top: 50%;
height: 100%;
width: auto;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-transform: translate(-50%, -50%);
}
<div class='grid'>
<div class='photo'>
<img src="http://www.customink.com/photos/system/images/39331/large/931213063.JPG?1410820504"/>
</div>
<div class='photo'>
<img src='http://www.customink.com/photos/system/images/28263/large/image.jpg?1392311502'/>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment