You need to specify flexible elements for the extension. By default, they do not consume free space.
The initial flex-basis setup is auto , which means the elements take up the size of their content.
The initial setting for flex-grow is 0 , which means that items will not grow in available space.
Add flex: 1 to your elements, which is equivalent to: flex: 1 1 0 , which is short for:
flex-grow: 1flex-shrink: 1flex-basis: 0 .
.flexbox { display: flex; } .flexbox div { flex: 1; border: 1px solid black; padding: 10px; }
<div class="flexbox"> <div>One</div> <div>Two</div> <div>Three</div> </div>
source share