I am facing an issue with my flex container setup involving three children elements. I have specified both minimum and maximum widths for each child, but I want them to grow or shrink in a specific order as the window width changes. Ideally, Item1 should shrink to its min width first, followed by Item2 shrinking to its min width, and finally Item3 adjusting accordingly. Can anyone guide me on what I might be doing incorrectly? I have reviewed the documentation multiple times but I still can't seem to grasp the solution.
<div className="MainContainer">
<div className="Item1">
I should shrink first/expand last!
</div>
<div className="Item2">
I should shrink & expand second!
</div>
<div className="Item3">
I should shrink last/expand first!
</div>
</div>
Below is the CSS code I'm using:
.MainContainer {
display: flex;
flex-direction: row;
justify-content: center;
padding-left: 15px;
padding-right: 15px;
}
//Should shrink first/expand last
.Item1{
min-width: 350px;
max-width: 816px;
flex: 1;
flex-grow: 0;
}
//Should shrink/expand second
.Item2{
max-width: 816px;
flex: 1;
flex-grow: 1;
}
//Should shrink last/expand first
.Item3{
min-width: 300px;
max-width: 224px;
flex: 1;
flex-grow: 2;
}