Twitter Bootstrap Button Group Control Radio Buttons/Checkboxes

后端 未结 5 820
攒了一身酷
攒了一身酷 2021-01-30 16:15

I am trying to use the Twitter Bootstrap button group as an actual set of form input controls. By default, these button groups can be made to function like a radio button or che

5条回答
  •  独厮守ぢ
    2021-01-30 16:46

    CSS-only solution:

    HTML:

    SCSS/LESS:

     label.btn {
        margin-bottom: 0;
        padding: 0;
        overflow: hidden;
    
        span {
          display: block;
          padding: 10px 15px;
        }
    
        input[type=checkbox] {
          display: none;
        }
    
        input:checked + span {
          display: block;
          color: #fff;
          background-color: #285e8e;
        }
      }
    

    JSfiddle here

提交回复
热议问题