This is my code:
*{
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
display: flex;
align-items: center;
justify-content: center;
}
.profile-card {
background-color: orange;
width: 500px;
}
<body>
<div class="profile-card">
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Laboriosam animi officia rem nemo, ullam excepturi quo incidunt quibusdam dolores blanditiis.</p>
</div>
</body>
This is how the output is without the div being centered.
What am I missing here? I am having a hard time understand the default behavior such as this
I tried adding height: 100vh
and then it gets centered.
What is the logic? I have been reading articles but still cant wrap my head around these