bootstrap-source/bootstrap-3.0.3/less/button-groups.less
author stetrabby <info@trabucchi.de>
Fri, 20 Dec 2013 22:49:16 +0100
changeset 54 0ded9d7748b7
permissions -rwxr-xr-x
initial less based on the pymove3d.css
info@54
     1
//
info@54
     2
// Button groups
info@54
     3
// --------------------------------------------------
info@54
     4
info@54
     5
// Make the div behave like a button
info@54
     6
.btn-group,
info@54
     7
.btn-group-vertical {
info@54
     8
  position: relative;
info@54
     9
  display: inline-block;
info@54
    10
  vertical-align: middle; // match .btn alignment given font-size hack above
info@54
    11
  > .btn {
info@54
    12
    position: relative;
info@54
    13
    float: left;
info@54
    14
    // Bring the "active" button to the front
info@54
    15
    &:hover,
info@54
    16
    &:focus,
info@54
    17
    &:active,
info@54
    18
    &.active {
info@54
    19
      z-index: 2;
info@54
    20
    }
info@54
    21
    &:focus {
info@54
    22
      // Remove focus outline when dropdown JS adds it after closing the menu
info@54
    23
      outline: none;
info@54
    24
    }
info@54
    25
  }
info@54
    26
}
info@54
    27
info@54
    28
// Prevent double borders when buttons are next to each other
info@54
    29
.btn-group {
info@54
    30
  .btn + .btn,
info@54
    31
  .btn + .btn-group,
info@54
    32
  .btn-group + .btn,
info@54
    33
  .btn-group + .btn-group {
info@54
    34
    margin-left: -1px;
info@54
    35
  }
info@54
    36
}
info@54
    37
info@54
    38
// Optional: Group multiple button groups together for a toolbar
info@54
    39
.btn-toolbar {
info@54
    40
  .clearfix();
info@54
    41
info@54
    42
  .btn-group {
info@54
    43
    float: left;
info@54
    44
  }
info@54
    45
  // Space out series of button groups
info@54
    46
  > .btn,
info@54
    47
  > .btn-group {
info@54
    48
    + .btn,
info@54
    49
    + .btn-group {
info@54
    50
      margin-left: 5px;
info@54
    51
    }
info@54
    52
  }
info@54
    53
}
info@54
    54
info@54
    55
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
info@54
    56
  border-radius: 0;
info@54
    57
}
info@54
    58
info@54
    59
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
info@54
    60
.btn-group > .btn:first-child {
info@54
    61
  margin-left: 0;
info@54
    62
  &:not(:last-child):not(.dropdown-toggle) {
info@54
    63
    .border-right-radius(0);
info@54
    64
  }
info@54
    65
}
info@54
    66
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
info@54
    67
.btn-group > .btn:last-child:not(:first-child),
info@54
    68
.btn-group > .dropdown-toggle:not(:first-child) {
info@54
    69
  .border-left-radius(0);
info@54
    70
}
info@54
    71
info@54
    72
// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
info@54
    73
.btn-group > .btn-group {
info@54
    74
  float: left;
info@54
    75
}
info@54
    76
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
info@54
    77
  border-radius: 0;
info@54
    78
}
info@54
    79
.btn-group > .btn-group:first-child {
info@54
    80
  > .btn:last-child,
info@54
    81
  > .dropdown-toggle {
info@54
    82
    .border-right-radius(0);
info@54
    83
  }
info@54
    84
}
info@54
    85
.btn-group > .btn-group:last-child > .btn:first-child {
info@54
    86
  .border-left-radius(0);
info@54
    87
}
info@54
    88
info@54
    89
// On active and open, don't show outline
info@54
    90
.btn-group .dropdown-toggle:active,
info@54
    91
.btn-group.open .dropdown-toggle {
info@54
    92
  outline: 0;
info@54
    93
}
info@54
    94
info@54
    95
info@54
    96
// Sizing
info@54
    97
//
info@54
    98
// Remix the default button sizing classes into new ones for easier manipulation.
info@54
    99
info@54
   100
.btn-group-xs > .btn { .btn-xs(); }
info@54
   101
.btn-group-sm > .btn { .btn-sm(); }
info@54
   102
.btn-group-lg > .btn { .btn-lg(); }
info@54
   103
info@54
   104
info@54
   105
// Split button dropdowns
info@54
   106
// ----------------------
info@54
   107
info@54
   108
// Give the line between buttons some depth
info@54
   109
.btn-group > .btn + .dropdown-toggle {
info@54
   110
  padding-left: 8px;
info@54
   111
  padding-right: 8px;
info@54
   112
}
info@54
   113
.btn-group > .btn-lg + .dropdown-toggle {
info@54
   114
  padding-left: 12px;
info@54
   115
  padding-right: 12px;
info@54
   116
}
info@54
   117
info@54
   118
// The clickable button for toggling the menu
info@54
   119
// Remove the gradient and set the same inset shadow as the :active state
info@54
   120
.btn-group.open .dropdown-toggle {
info@54
   121
  .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
info@54
   122
info@54
   123
  // Show no shadow for `.btn-link` since it has no other button styles.
info@54
   124
  &.btn-link {
info@54
   125
    .box-shadow(none);
info@54
   126
  }
info@54
   127
}
info@54
   128
info@54
   129
info@54
   130
// Reposition the caret
info@54
   131
.btn .caret {
info@54
   132
  margin-left: 0;
info@54
   133
}
info@54
   134
// Carets in other button sizes
info@54
   135
.btn-lg .caret {
info@54
   136
  border-width: @caret-width-large @caret-width-large 0;
info@54
   137
  border-bottom-width: 0;
info@54
   138
}
info@54
   139
// Upside down carets for .dropup
info@54
   140
.dropup .btn-lg .caret {
info@54
   141
  border-width: 0 @caret-width-large @caret-width-large;
info@54
   142
}
info@54
   143
info@54
   144
info@54
   145
// Vertical button groups
info@54
   146
// ----------------------
info@54
   147
info@54
   148
.btn-group-vertical {
info@54
   149
  > .btn,
info@54
   150
  > .btn-group,
info@54
   151
  > .btn-group > .btn {
info@54
   152
    display: block;
info@54
   153
    float: none;
info@54
   154
    width: 100%;
info@54
   155
    max-width: 100%;
info@54
   156
  }
info@54
   157
info@54
   158
  // Clear floats so dropdown menus can be properly placed
info@54
   159
  > .btn-group {
info@54
   160
    .clearfix();
info@54
   161
    > .btn {
info@54
   162
      float: none;
info@54
   163
    }
info@54
   164
  }
info@54
   165
info@54
   166
  > .btn + .btn,
info@54
   167
  > .btn + .btn-group,
info@54
   168
  > .btn-group + .btn,
info@54
   169
  > .btn-group + .btn-group {
info@54
   170
    margin-top: -1px;
info@54
   171
    margin-left: 0;
info@54
   172
  }
info@54
   173
}
info@54
   174
info@54
   175
.btn-group-vertical > .btn {
info@54
   176
  &:not(:first-child):not(:last-child) {
info@54
   177
    border-radius: 0;
info@54
   178
  }
info@54
   179
  &:first-child:not(:last-child) {
info@54
   180
    border-top-right-radius: @border-radius-base;
info@54
   181
    .border-bottom-radius(0);
info@54
   182
  }
info@54
   183
  &:last-child:not(:first-child) {
info@54
   184
    border-bottom-left-radius: @border-radius-base;
info@54
   185
    .border-top-radius(0);
info@54
   186
  }
info@54
   187
}
info@54
   188
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
info@54
   189
  border-radius: 0;
info@54
   190
}
info@54
   191
.btn-group-vertical > .btn-group:first-child {
info@54
   192
  > .btn:last-child,
info@54
   193
  > .dropdown-toggle {
info@54
   194
    .border-bottom-radius(0);
info@54
   195
  }
info@54
   196
}
info@54
   197
.btn-group-vertical > .btn-group:last-child > .btn:first-child {
info@54
   198
  .border-top-radius(0);
info@54
   199
}
info@54
   200
info@54
   201
info@54
   202
info@54
   203
// Justified button groups
info@54
   204
// ----------------------
info@54
   205
info@54
   206
.btn-group-justified {
info@54
   207
  display: table;
info@54
   208
  width: 100%;
info@54
   209
  table-layout: fixed;
info@54
   210
  border-collapse: separate;
info@54
   211
  > .btn,
info@54
   212
  > .btn-group {
info@54
   213
    float: none;
info@54
   214
    display: table-cell;
info@54
   215
    width: 1%;
info@54
   216
  }
info@54
   217
  > .btn-group .btn {
info@54
   218
    width: 100%;
info@54
   219
  }
info@54
   220
}
info@54
   221
info@54
   222
info@54
   223
// Checkbox and radio options
info@54
   224
[data-toggle="buttons"] > .btn > input[type="radio"],
info@54
   225
[data-toggle="buttons"] > .btn > input[type="checkbox"] {
info@54
   226
  display: none;
info@54
   227
}
Impressum Datenschutzerklärung