I am attempting to make a row of buttons responsive. There can be either 3 or 2 buttons in the row. The reason I'm thinking flexbox (or maybe grid) is the solution is because the text in the buttons is internationalized and the language will vary meaning they will wrap depending on the text in the buttons, not just the screen width so I can't just write media queries that correspond to screen width.
These are the initial states with no wrapping: The starting states (no wrapping) are either of these images (depending on 2 or 3 buttons):
These are the desired wrapping states when the container gets too small:
I created a fiddle that allows you to adjust the width of the box and toggle the optional button here:
See Fiddle here to test each variant
This is the starting html, but maybe it would help to wrap the first two buttons together
<div class="container">
<div class="button button1">
This is a longer button
</div>
<div class="button button2">
Optional Button
</div>
<div class="button button3">
Confirmation button
</div>
</div>
<button class="width-button">Toggle width</button>
<button class="toggle-button-button">Toggle optional button</button
>



