A Pen by Manot Luijiu on CodePen.
Created
May 14, 2022 11:31
-
-
Save ManotLuijiu/1524ae5b60f978e1674e3d010d6765e9 to your computer and use it in GitHub Desktop.
Using Flex to center
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
<div class="container"> | |
<h1>Center an element both Horizontally and Vertically using flexbox</h1> | |
</div> |
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
body, | |
html { | |
padding: 0; | |
margin: 0; | |
} | |
.container { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
height: 100vh; | |
} | |
h1 { | |
color: #0984e3; | |
font-size: 80px; | |
text-align: center; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment