Let Get Fluid!
There are many answers here!
The following example works in all screen sizes / widths for up to three drawers.
The fact that @media used to transfer and remove borders at each width of the viewport, from one column to three columns. It also resizes the outer div for each step and changes the background color, etc., if necessary. Refer to the fragment comments for a basic explanation of what is happening.
This example can consume as many or several boxes as you want. Open it full screen and resize to see the results.
Update . I gave the insiders a dark green background, and the external display: inline-block resized with its contents.

* { box-sizing: border-box; } .outer_div { margin: 50px; display: inline-block; max-width: 640px; min-width: 240px; padding: 20px; transition: background 1s; transition: max-width 0.05s; } .inner_div { min-height: 238px; border: 1px dashed #000; float: left; padding: 9px; width: 200px; background: #0a8f08; } .outer_div:after { content: ' '; display: block; clear: left; } @media screen and (min-width: 756px) { .outer_div { background: #a3e9a4; } .inner_div { border-bottom: none } .inner_div:nth-child(3n+2) { border-right: none; border-left: none; } .inner_div:last-child { border-right: 1px dashed #000; } .inner_div:nth-last-child(-n+3) { border-bottom: 1px dashed #000; } } @media screen and (min-width: 573px) and (max-width: 755px) { .outer_div { max-width: 440px; background: #dcedc8; } .inner_div { border-bottom: none; } .inner_div:nth-child(2n) { border-left: none; } .inner_div:nth-last-child(-n+2) { border-bottom: 1px dashed #000; } } @media screen and (max-width: 572px) { .outer_div { max-width: 240px; background: #f0f4c3; } .inner_div { border-bottom: none; } .inner_div:last-child { border-bottom: 1px dashed #000; } }
<div class="outer_div"> <div class="inner_div"></div> <div class="inner_div"></div> <div class="inner_div"></div> <div class="inner_div"></div> <div class="inner_div"></div> <div class="inner_div"></div> </div>
source share