Skip to content

Instantly share code, notes, and snippets.

@allanminium
Created March 1, 2019 00:06
Show Gist options
  • Select an option

  • Save allanminium/f01c6f3c82f9981e81e963a44fc7cc5e to your computer and use it in GitHub Desktop.

Select an option

Save allanminium/f01c6f3c82f9981e81e963a44fc7cc5e to your computer and use it in GitHub Desktop.
[Vertical Align Image or Text] Vertical align images or text in CSS #css
.container {
position: relative;
}
.container .element {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
/* https://stackoverflow.com/questions/10008670/vertical-align-image-in-div */
/* https://jsfiddle.net/Cthulhu/1xjbhsr4/ */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment