Created
December 28, 2016 19:16
-
-
Save kovtunos/58b6656df08f5430b5386d61ead66cfc to your computer and use it in GitHub Desktop.
Emulate background-cover for inline html img #sass
This file contains hidden or 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
| .cover-image { | |
| overflow: hidden; | |
| position: relative; | |
| top: 0; | |
| right: 0; | |
| bottom: 0; | |
| left: 0; | |
| height: 150px; | |
| img { | |
| position: absolute; | |
| top: 50%; | |
| left: 50%; | |
| width: auto; | |
| height: auto; | |
| max-height: none; | |
| max-width: none; | |
| min-height: 100%; | |
| min-width: 100%; | |
| transform: translate(-50%, -50%); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment