Atif Choudhury• 50
@AChoudhury-Cyber
Submitted
@mreed4
@AChoudhury-Cyber
Submitted
@mreed4
Posted
Centering on a web page has come a long way since I first started teaching myself all of this stuff so long ago. One way to do it, a modern way that probably now has enough coverage across enough browsers, is to set the CSS as something like the following:
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container { /* This represents the main div of your page/app */
margin: auto;
width: 20rem;
background-color: var(--very-dark-blue-card);
padding: 1.25rem;
border-radius: 1rem;
}