I have a parent div with some childs, when number of child is more than 5 I create another column and I put others childs, the problem is my div not fit content,this is my parent div with some childs:
When I add another item it look like:
I've tried width: fit-content
but not work's, output:
EDIT: I want to have a fixed height of my parent,always 450px
This is my code :
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
max-height: 450px;
background: lightblue;
width: fit-content;
word-wrap: break-word;
}
.item {
border: 1px solid black;
border-radius: 2%;
margin: 12px 10px;
width: 100px;
}
<div class="container">
<div class="item">
<p>Paragraph 1</p>
</div>
<div class="item">
<p>Paragraph 1</p>
</div>
<div class="item">
<p>Paragraph 1</p>
</div>
<div class="item">
<p>Paragraph 1</p>
</div>
<div class="item">
<p>Paragraph 1</p>
</div>
<div class="item">
<p>Paragraph 1</p>
</div>
</div>
I want to get the background cover all children's div