Skip to content

Instantly share code, notes, and snippets.

@steevehook
Last active October 11, 2018 12:58
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 steevehook/40dbf6c2f592bdaed7838bbd91493733 to your computer and use it in GitHub Desktop.
Save steevehook/40dbf6c2f592bdaed7838bbd91493733 to your computer and use it in GitHub Desktop.
Correct aspect ratio for images
&__image {
position: relative;
display: flex;
justify-content: center;
a {
width: 100%;
height: 0;
padding-bottom: 95%;
}
img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment