Created
October 3, 2014 15:00
-
-
Save eristoddle/d948e8490a51b3f98dcf to your computer and use it in GitHub Desktop.
To scale and center an image based on wrapper size
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
.field-items { | |
position: absolute; | |
margin: auto; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
width: 60%; | |
height: 60%; | |
.field-item { | |
img { | |
position: absolute; | |
margin: auto; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
max-width: 100%; | |
max-height: 100%; | |
width: auto; | |
height: auto; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment