Skip to content

Instantly share code, notes, and snippets.

@revooms
Last active March 29, 2018 12:05
Show Gist options
  • Select an option

  • Save revooms/92a871d78308af8ad2fe4cfcf5165258 to your computer and use it in GitHub Desktop.

Select an option

Save revooms/92a871d78308af8ad2fe4cfcf5165258 to your computer and use it in GitHub Desktop.
Vertical align image in container
.image-va { box-sizing: content-box; width:100%; height:100%; vertical-align: middle; text-align: center; background-color:lime}
.image-va img { border:0 !important; margin:0 !important; max-width: 100%; max-height: 100%; vertical-align: middle;}
.image-va .helper { display: inline-block; height: 100%; vertical-align: middle;}
<div class="image-va">
<span class="helper"></span><img src="">
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment