Skip to content

Instantly share code, notes, and snippets.

@ALTELMA
Created September 19, 2019 18:09
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 ALTELMA/a5168159264bd47bb4e597a40a5914b3 to your computer and use it in GitHub Desktop.
Save ALTELMA/a5168159264bd47bb4e597a40a5914b3 to your computer and use it in GitHub Desktop.
Image-crop-center
a {
display: block;
width: 200px;
height: 200px;
overflow: hidden;
margin: 10px;
position: relative;
border: solid 1px #353535;
}
img {
position:absolute;
left: -100%;
right: -100%;
top: -100%;
bottom: -100%;
margin: auto;
min-height: 100%;
min-width: 100%;
}
<a>
<img class="img-thumb"
src="https://s-media-cache-ak0.pinimg.com/236x/3a/ef/64/3aef64b6678201ef4e4d8e5b5007f96e.jpg"
>
</a>
<a>
<img class="img-thumb"
src="https://s-media-cache-ak0.pinimg.com/236x/e4/c9/82/e4c982a64d6870b904721a4737339172.jpg"
>
</a>
<a>
<img class="img-thumb"
src="https://s-media-cache-ak0.pinimg.com/736x/f4/56/6d/f4566dfded2bb9abeacbe42feb8a7c2d.jpg"
>
</a>
<a>
<img class="img-thumb"
src="http://pre04.deviantart.net/9e90/th/pre/i/2013/068/4/3/lia__manga_by_sophie__chan-d5xgpu2.jpg"
>
</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment