Skip to content

Instantly share code, notes, and snippets.

@lwcooper
Forked from anonymous/dabblet.css
Created July 23, 2014 02:54
Show Gist options
  • Select an option

  • Save lwcooper/3eb02e3e24dc45c0c858 to your computer and use it in GitHub Desktop.

Select an option

Save lwcooper/3eb02e3e24dc45c0c858 to your computer and use it in GitHub Desktop.
Untitled
.img-wrapper {
width: 300px;
height: 150px;
overflow: hidden;
position: relative;
float: left;
margin: 20px;
}
img {
position: absolute;
min-width: 100%;
min-height: 100%;
transform: translate(-50%,-50%);
top: 50%;
left: 50%;
}
<div class="img-wrapper"><img src="http://placekitten.com/200/300" /></div>
<div class="img-wrapper"><img src="http://placekitten.com/500/600" /></div>
<div class="img-wrapper"><img src="http://placekitten.com/300/150" /></div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment