Skip to content

Instantly share code, notes, and snippets.

@Yelakelly
Created August 28, 2017 08:49
Show Gist options
  • Save Yelakelly/234f6d70ff637efd9ff2bdd0904639b9 to your computer and use it in GitHub Desktop.
Save Yelakelly/234f6d70ff637efd9ff2bdd0904639b9 to your computer and use it in GitHub Desktop.
Background - center (without transform)
img{
position: absolute;
/* Position the image in the middle of its container. */
top: -9999px;
right: -9999px;
bottom: -9999px;
left: -9999px;
margin: auto;
/* The following values determine the exact image behaviour. */
/* You can simulate background-size: cover/contain/etc.
by changing between min/max/standard width/height values.
These values simulate background-size: cover
*/
min-width: 100%;
min-height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment