Created
April 1, 2021 19:19
-
-
Save kristofgilicze/ffd4ccaccf1b30dc0b9da2baeb0d5c2b to your computer and use it in GitHub Desktop.
The age old question of centering a DIV, the modern way.
This file contains 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
/* | |
<div class="wrapper"> | |
<div></div> | |
</div> | |
*/ | |
/* With Grid */ | |
.wrapper { | |
display: grid; | |
place-items: center; | |
} | |
/* With Flex */ | |
.wrapper { | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment