<div class="flex-container">
<div class="main-column">
Main content
</div>
<div class="sidebar">
<span>Sidebar</span>
</div>
</div>
xxxxxxxxxx
.sidebar {
padding: 10px;
background: #e34122;
flex: 1 1 auto;
/* Uncomment the line below to see the fix in action */
/* min-width: 0; */
}
.flex-container {
display: flex;
gap: 10px;
width: 400px;
font-family: arial;
font-size: 14px;
border: 1px dotted blue;
gap: 10px;
padding: 10px;
}
.main-column {
flex: 1 0 300px;
padding: 10px;
background: #eee;
}
span {
display: inline-block;
width: 400px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.