Last active
October 21, 2019 16:39
-
-
Save isabellachen/1bf1892b3769b0362891f5e8eb0cfa53 to your computer and use it in GitHub Desktop.
Centering an element without flexbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Flexbox should be the answer. But this is for those times flexbox does not suit your needs*/ | |
.graphic-wrapper { | |
position: relative; | |
} | |
.graphic { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment