The effect I would like to create is like this
On desktop, there are case that have 1 to 3 buttons.
If 3 buttons , it should match the full width of the body , and leave a margin between button.
If less than 3 buttons , it should align center.
|[button 1] [button 2] [button 3]|
| [button 1] [button 2] |
On Mobile , no matter how many buttons, align center
| [button 1] |
| [button 2] |
| [button 3] |
I have developed using bootstrap grid, but it seems not suitable for dynamic case:
<div class="col-xs-12 col-sm-4 text-center res-pad same-width-button">
<a class="btn btn-blue get_loc">button 1</a>
</div>
<div class="col-xs-12 col-sm-4 text-center res-pad same-width-button">
<a class="btn btn-blue get_loc">button 2</a>
</div>
<div class="col-xs-12 col-sm-4 text-center res-pad same-width-button">
<a class="btn btn-blue get_loc">button 3</a>
</div>
How to modify or simply using CSS is better for this case? Thanks a lot for helping.