Recent Post Below: I've replicated a minimized issue: https://codepen.io/MH-123/pen/ExJWQWq?editors=1100 In the provided CodePen, the problem persists. Two divs are present, but flex shrink functionality is not working as expected.
The main flex container consists of a single row with two columns. Each column is also a flex container, but this detail may not be relevant. My goal is for the left column to shrink faster than the right column when the screen width is reduced horizontally, resulting in a proportional reduction in size for the items within the columns.
Despite numerous attempts, such as applying flex shrink to the columns, adjusting flex basis, and eliminating widths, the issue remains unresolved:
https://codepen.io/MH-123/pen/gOymoqM?editors=1100
/* BASE STYLES */
:root {
--clr-dark: #0f172a;
--clr-light: #f1f5f9;
--clr-accent: #e11d48;
}
*,*::before,*::after {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
line-height: 1.6;
word-spacing: 1.4px;
font-family: "Roboto", sans-serif;
color: var(--clr-dark);
background-color: var(--clr-light);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
width: 50%;
height: 650px;
margin: 0 auto;
border: 10px solid var(--clr-dark);
}
.item {
background-color: #fb7185;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid red;
}
/* END OF BASE STYLES */
.container {
display: flex;
flex: row nowrap;
}
.colLeft, .colRight {
height: 100%;
border: 5px solid blue;
display: flex;
flex-flow: column nowrap;
justify-content: space-evenly;
align-items: center;
align-content: space-around;
}
.colLeft {
flex-grow: 1;
flex-shrink: 10;
}
.colRight {
flex-grow: 1;
flex-shrink 1;
}
.item-1 {
flex: 0 1 30%;
width: 95%;
display: flex;
}
.item-a {
height: 100%;
width: 50%;
}
.item-b {
height: 100%;
width: 50%;
}
.item-2 {
flex: 0 1 55%;
width: 95%;
}
.item-3 {
flex: 0 0 55%;
width: 95%;;
}
.item-4 {
flex: 0 0 30%;
width: 95%;
}
<div class="container">
<div class="colLeft">
<div class="item item-1">
<div class="item item-a">1a</div>
<div class="item item-b">1b</div>
</div>
<div class="item item-2">2</div>
</div>
<div class="colRight">
<div class="item item-3">3</div>
<div class="item item-4">4</div>
</div>
</div>
edit: Here's another CodePen version where I've removed all widths from the children https://codepen.io/MH-123/pen/abxJqZg?editors=0100