Left & right align modal footer buttons in Bootstrap 4

后端 未结 9 1169
广开言路
广开言路 2021-01-31 01:21

Bootstrap 4 uses flex-box for it\'s modal footers. If I want two buttons, one on the left and one on the right, how do I get it to work properly?

The code below tries t

9条回答
  •  南笙
    南笙 (楼主)
    2021-01-31 01:41

    Now that the modal-footer is "display:flex" in Bootstrap 4, it would be easiest to use the auto-margins. Use mr-auto on the left button.

    
    

    Demo

    Also see: Left align and right align within div in Bootstrap


    Follow-up to comment "What if I need the button on the right to occupy all the space left?" - Use the btn-block class:

    
    

提交回复
热议问题