I have 1 parent container div with 2 child divs.
What I need is that:
- Parent has max width (easy)
- If width of 1st child increases, width of parent also increases (limited by max-width)
- If width of 2nd child increases, nothing happens
So basically, parent width is only controlled by 1st child and if 1st child is 100px width and 2nd child is 200px, than parent is 100px.
Draft css in jsbin:
BODY {
padding: 20px;
background: white;
}
.container {
padding: 10px;
background: gold;
border-radius: 10px;
display: flex;
flex-direction: column;
max-width: 350px;
min-width: 0;
}
.item1 {
margin: 10px;
padding: 5px;
background: tomato;
border-radius: 5px;
border: 1px solid #FFF;
flex-flow: row nowrap;
box-sizing: border-box;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
flex: 1;
}
.item2 {
margin: 10px;
padding: 5px;
background: tomato;
border-radius: 5px;
border: 1px solid #FFF;
flex-flow: row nowrap;
box-sizing: border-box;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}