So, I have been wondering why the div in this code has refused to work with justify-content: center;
.txt-container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
}
.box {
background-color: #D0D3D4;
width: 50%;
border: 3px solid #17202A;
}
<section class="bg">
<div class="txt-container">
<div class="box">
<div class="txt-box">
<p class="propmt-text">Hello, what's your name?</p>
</div>
<div class="txt-box">
<p class="propmt-text">Hello, what's your name?</p>
</div>
<div class="nameparabox">
<p class="nameparagraph">My name is </p>
<p class="namefield"></p>
</div>
</div>
</div>
</section>
So, basically, I want the div with the class name 'box' to be centered on the screen along with the contents inside it. Why is justify-content not working? If I use 'margin: auto;' it works.