Skip to content

Instantly share code, notes, and snippets.

@craiger522
Created November 6, 2013 17:57
Show Gist options
  • Save craiger522/7340956 to your computer and use it in GitHub Desktop.
Save craiger522/7340956 to your computer and use it in GitHub Desktop.
horizontal and vertical centering
.absolute-aligned {
position: relative; min-height: 500px;
background: hsl(200, 100%, 97%);
}
.absolute-aligned img {
width: 50%;
min-width: 200px;
height: auto;
overflow: auto; margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
}
some form of height must be declared for the outer container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment