I have just started learning CSS, I ran into this problem. Please excuse me if its too silly to ask.
I want to center a DIV inside the body tag. I tired to use flexbox for this but somehow its coming in the center of the screen.
Here is the code.
<html lang="en">
<body>
<style type="text/css">
body
{
background: #6CB3A9;
display: flex;
justify-content: center;
align-items: center;
}
.main
{
width:300px;
height:300px;
background:white;
}
</style>
<div class="main">
<div class="white-bottom"></div>
<div class="red-top"></div>
<div class="yellow-center"></div>
</div>
</body>
</html>