Fixed width buttons with Bootstrap

后端 未结 12 537
臣服心动
臣服心动 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:11

    A block width button could easily become responsive button if the parent container is responsive. I think that using a combination of a fixed width and a more detailed selector path instead of !important because:

    1) Its not a hack (setting min-width and max-width the same is however hacky)

    2) Does not use the !important tag which is bad practice

    3) Uses width so will be very readable and anyone who understands how cascading works in CSS will see whats going on (maybe leave a CSS comment for this?)

    4) Combine your selectors that apply to your targeted node for increased accuracy

    .parent_element .btn.btn-primary.save-button {
        width: 80px;
    }
    

提交回复
热议问题