Skip to content

Instantly share code, notes, and snippets.

@ABooooo
Last active April 3, 2019 07:55
Show Gist options
  • Save ABooooo/2e68864e418e16beb23dca8f5ce1c189 to your computer and use it in GitHub Desktop.
Save ABooooo/2e68864e418e16beb23dca8f5ce1c189 to your computer and use it in GitHub Desktop.
.child {
position: absolute;
top: 50%; /* position the top edge of the element at the middle of the parent */
left: 50%; /* position the left edge of the element at the middle of the parent */
transform: translate(-50%, -50%); /* This is a shorthand of
translateX(-50%) and translateY(-50%) */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment