Skip to content

Instantly share code, notes, and snippets.

@ManotLuijiu
Created May 14, 2022 11:31
Show Gist options
  • Save ManotLuijiu/1524ae5b60f978e1674e3d010d6765e9 to your computer and use it in GitHub Desktop.
Save ManotLuijiu/1524ae5b60f978e1674e3d010d6765e9 to your computer and use it in GitHub Desktop.
Using Flex to center
<div class="container">
<h1>Center an element both Horizontally and Vertically using flexbox</h1>
</div>
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