Skip to content

Instantly share code, notes, and snippets.

@wjramos
Last active April 22, 2026 19:48
Show Gist options
  • Select an option

  • Save wjramos/d7377f3a537388523977 to your computer and use it in GitHub Desktop.

Select an option

Save wjramos/d7377f3a537388523977 to your computer and use it in GitHub Desktop.
.frame {
position: relative;
min-height: XXX;
min-height: XXX;
overflow: hidden;
}
.frame img {
position: absolute;
/*
left: -100%;
right: -100%;
top: -100%;
bottom: -100%;
margin: auto;
width: auto;
height: auto;
*/
top: 50%;
left: 50%;
width: 100%;
height: auto;
min-width: 100%;
min-height: 100%;
-webkit-transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
transform: translate(-50%, -50%);
-o-object-fit: cover;
object-fit: cover;
object-position: center;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment