Problem
I want to bigger width for my flex images. It is shrinked up and I cannot understand why i cannot increase the width of it.
display:flex;
max-width:95%;
width:95%;
margin:auto;
background-color: #052F1A;
gap:10px;
}
.bowl_images_section_1{
display: flex;
background-image: url(./images/piece-1.jpg);
background-size:contain;
width:100%;
height:400px;
background-position: 0% 0%;
background-size: 100% 100%;
}
.bowl_images p{
display: flex;
font-size:12px;
background-color: #FF72B5;
color:#052F1A;
padding:3px;
margin:auto;
border-radius: 3px;
text-wrap: wrap;
}
HTML Code… I have used flexbox and want a bigger width for each flex child.
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
<div class="bowl_images_section_1"> <p>Original Pieces</p> </div>
</div>
2
Answers
Hear, you can add the
max-width
to the child element as per you need the child width. I add theflex-wrap:wrap
property to the flexible items should wrap. When your child’s size does not get enough space to move from one row to the next row.You are almost there. You don’t need to flex property on each element. The main and the child could have flex property while p tag does not need.
I have made few changes to make it look proper.