Justify buttons with Bootstrap v4

前端 未结 4 1827
别跟我提以往
别跟我提以往 2021-02-01 15:00

Bootstrap v4 drops the .btn-group-justified class, see https://github.com/twbs/bootstrap/issues/17631

How to justify the button for:

 

        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 15:38

    Building on Bass Jobsen's great answer, here is the same functionality using flexbox instead of display: table;

    SCSS code

    // Justified button groups
    // ----------------------
    
    .btn-group-justified {
      display: flex;
      width: 100%;
      .btn,
      .btn-group {
        flex: 1;
        .btn {
          width: 100%;
        }
        .dropdown-menu {
          left: auto;
        }
      }
    }
    

    HTML

    
    

    Please refer to Bass Jobsen's answer for more details on usage with dropdowns, HTML Links and more.

提交回复
热议问题