What im after is exactly THIS here.
The solutions provided are
- "js, jquery", jquery is def. not desired. Would like to avoid vanilla js also.
- "css, html only", but hacky and not general enough.
How can this be archieved without hacking, staying general and dynamic and not having to use javascript?
I dont really care what css technique is used. flex, table, grid. As long as its general and dynamic.
Here is a playground ==> jsfiddle <== I have prepared.
The red borderline should be a small as possible without creating further wrapping.
<h3>
3. with window resize (resize the windows width )
</h3>
looks like
<div class="IwillForceAgivenWidth" style="width: 100%">
<div class="parent">
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
<button class="child">some text here longer Text</button>
</div>
</div>