So I am attempting to use flexbox to center my name in the middle of the screen.
After looking through many upon many tutorials they say the only code I need to accomplish this, is...
div {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
<div>
<h1>
David
</h1>
</div>
If you try the code above, it only centers the box horizontally.
I found some other code that accomplishes the desired effect:
div {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
position: absolute;
}
<div>
<h1>
David
</h1>
</div>
but it seems a little hacky, and it just seems wrong.
Any help in what I am doing wrong would definitely be much appreciated.
Thank You.