Prevent bootstrap button groups from breaking
Asked Answered
H

1

11

How can I prevent bootstrap button goups from breaking in to 2 lines when there is less space?

I am trying to use the below Bootstrap code:

   <div class="btn-group" style=" width:100px ;">
        <button type="button" class="btn btn-default" style=" width:30px;">-</button>
        <input type="text" class="form-control" style="width:30px;">   
        <button type="button" class="btn btn-default" style=" width:30px;"> +</button>
    </div>

And it looks like:

enter image description here

Hebetude answered 19/4, 2014 at 8:17 Comment(2)
add an extra style inline and change the width, eg <div class="btn-group" style="width:300px">Goforth
still not working. i was edited the original post.Hebetude
A
21

This is what worked for me, turn the group of buttons to a flex item (by default it does not wrap):

.btn-group {
  display: flex;
}

I saw this here, and there are more options too: https://github.com/twbs/bootstrap/issues/9939

Ayres answered 28/11, 2016 at 7:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.