JSFiddle - React, Tailwind, and code Playground

by shuja uddin

HTML

<div class="container">
    <div class="box box1"><span>1</span></div>
    <div class="box box2"><span>2</span></div>
    <div class="box box3"><span>3</span></div>
</div>

CSS

.container {
    display: flex;
}


.box {
    height: 50px;
    width: 100px;
    margin: 10px;
    background-color: lightgreen;
    
    /* non-essential decorative styles */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
}

.box3 { flex-grow: 1; } 
/* now box3 is trying its best to reach both ends of the container. It's being blocked by box2 and box1. As each obstruction is removed, box3 keeps stretching. */

.box2 { /* display: none; */ } /* uncomment to see flex grow work */

.box1 { /* display: none; */ }