Skip to content

Instantly share code, notes, and snippets.

@danielmackay
Last active December 25, 2015 13:39
Show Gist options
  • Save danielmackay/6985544 to your computer and use it in GitHub Desktop.
Save danielmackay/6985544 to your computer and use it in GitHub Desktop.
Responsive image centering. <li> is just the parent and can be any element. #css, #less, #center
.photo-fullscreen {
position: fixed;
z-index: 99;
color: white;
height: 100%;
width: 100%;
li {
text-align: center;
}
li:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
img {
display: inline-block;
vertical-align: middle;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment