Fixed width buttons with Bootstrap

后端 未结 12 539
臣服心动
臣服心动 2021-01-29 18:36

Does Bootstrap support fixed width buttons? Currently if I have 2 buttons, \"Save\" and \"Download\", the button size changes based on content.

Also what is the right wa

12条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-29 19:13

    To do this you can come up with a width you feel is ok for both buttons and then create a custom class with the width and add it to your buttons like so:

    CSS

    .custom {
        width: 78px !important;
    }
    

    I can then use this class and add it to the buttons like so:

    Demo: http://jsfiddle.net/yNsxU/

    You can take that custom class you create and place it inside your own stylesheet, which you load after the bootstrap stylesheet. We do this because any changes you place inside the bootstrap stylesheet might get accidentally lost when you update the framework, we also want your changes to take precedence over the default values.

提交回复
热议问题