Last active
December 16, 2019 12:52
-
-
Save davaynamore/f6bffc2a55f2e7b69ab80e2bd78ed963 to your computer and use it in GitHub Desktop.
padding hack for images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin padding-hack($padding, $object-fit: contain) { | |
position: relative; | |
padding-top: $padding; | |
@content; | |
& > img { | |
position: absolute; | |
top: 0; | |
right: 0; | |
bottom: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
object-fit: $object-fit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment