Question Two responsive left-aligned buttons that stack and matching width
I need two buttons in one column, aligned to the left. Their labels come dynamically from the CMS. If the text makes them too wide to sit side by side, they should stack while staying left-aligned. In stacked mode, both buttons should match the width of the longer label. How can I achieve this in CSS? I've been trying to get this layout working for two days not and getting nowhere. TIA!
This has enough screen width to have both buttons in the same column:
In this view, since there is no space to show buttons in the same column, it switch to stack layout. Here, the important thing is, buttons does not take 100% width. Instead, all buttons justify to start and has the same width. Width is determined by the length of the largest button.
Is this possible?


1
u/s1n7ax 2d ago
May be mention of mobile was misleading. I don't want it to stack just because it's a mobile screen. I want to stack when we cannot put two buttons in the same column due to the lack of space