static/less/input-groups.less
author stetrabby <info@trabucchi.de>
Fri, 20 Dec 2013 22:30:44 +0100
changeset 53 3416f82943ea
permissions -rwxr-xr-x
less initial added
info@53
     1
//
info@53
     2
// Input groups
info@53
     3
// --------------------------------------------------
info@53
     4
info@53
     5
// Base styles
info@53
     6
// -------------------------
info@53
     7
.input-group {
info@53
     8
  position: relative; // For dropdowns
info@53
     9
  display: table;
info@53
    10
  border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table
info@53
    11
info@53
    12
  // Undo padding and float of grid classes
info@53
    13
  &[class*="col-"] {
info@53
    14
    float: none;
info@53
    15
    padding-left: 0;
info@53
    16
    padding-right: 0;
info@53
    17
  }
info@53
    18
info@53
    19
  .form-control {
info@53
    20
    width: 100%;
info@53
    21
    margin-bottom: 0;
info@53
    22
  }
info@53
    23
}
info@53
    24
info@53
    25
// Sizing options
info@53
    26
//
info@53
    27
// Remix the default form control sizing classes into new ones for easier
info@53
    28
// manipulation.
info@53
    29
info@53
    30
.input-group-lg > .form-control,
info@53
    31
.input-group-lg > .input-group-addon,
info@53
    32
.input-group-lg > .input-group-btn > .btn { .input-lg(); }
info@53
    33
.input-group-sm > .form-control,
info@53
    34
.input-group-sm > .input-group-addon,
info@53
    35
.input-group-sm > .input-group-btn > .btn { .input-sm(); }
info@53
    36
info@53
    37
info@53
    38
// Display as table-cell
info@53
    39
// -------------------------
info@53
    40
.input-group-addon,
info@53
    41
.input-group-btn,
info@53
    42
.input-group .form-control {
info@53
    43
  display: table-cell;
info@53
    44
info@53
    45
  &:not(:first-child):not(:last-child) {
info@53
    46
    border-radius: 0;
info@53
    47
  }
info@53
    48
}
info@53
    49
// Addon and addon wrapper for buttons
info@53
    50
.input-group-addon,
info@53
    51
.input-group-btn {
info@53
    52
  width: 1%;
info@53
    53
  white-space: nowrap;
info@53
    54
  vertical-align: middle; // Match the inputs
info@53
    55
}
info@53
    56
info@53
    57
// Text input groups
info@53
    58
// -------------------------
info@53
    59
.input-group-addon {
info@53
    60
  padding: @padding-base-vertical @padding-base-horizontal;
info@53
    61
  font-size: @font-size-base;
info@53
    62
  font-weight: normal;
info@53
    63
  line-height: 1;
info@53
    64
  color: @input-color;
info@53
    65
  text-align: center;
info@53
    66
  background-color: @input-group-addon-bg;
info@53
    67
  border: 1px solid @input-group-addon-border-color;
info@53
    68
  border-radius: @border-radius-base;
info@53
    69
info@53
    70
  // Sizing
info@53
    71
  &.input-sm {
info@53
    72
    padding: @padding-small-vertical @padding-small-horizontal;
info@53
    73
    font-size: @font-size-small;
info@53
    74
    border-radius: @border-radius-small;
info@53
    75
  }
info@53
    76
  &.input-lg {
info@53
    77
    padding: @padding-large-vertical @padding-large-horizontal;
info@53
    78
    font-size: @font-size-large;
info@53
    79
    border-radius: @border-radius-large;
info@53
    80
  }
info@53
    81
info@53
    82
  // Nuke default margins from checkboxes and radios to vertically center within.
info@53
    83
  input[type="radio"],
info@53
    84
  input[type="checkbox"] {
info@53
    85
    margin-top: 0;
info@53
    86
  }
info@53
    87
}
info@53
    88
info@53
    89
// Reset rounded corners
info@53
    90
.input-group .form-control:first-child,
info@53
    91
.input-group-addon:first-child,
info@53
    92
.input-group-btn:first-child > .btn,
info@53
    93
.input-group-btn:first-child > .dropdown-toggle,
info@53
    94
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
info@53
    95
  .border-right-radius(0);
info@53
    96
}
info@53
    97
.input-group-addon:first-child {
info@53
    98
  border-right: 0;
info@53
    99
}
info@53
   100
.input-group .form-control:last-child,
info@53
   101
.input-group-addon:last-child,
info@53
   102
.input-group-btn:last-child > .btn,
info@53
   103
.input-group-btn:last-child > .dropdown-toggle,
info@53
   104
.input-group-btn:first-child > .btn:not(:first-child) {
info@53
   105
  .border-left-radius(0);
info@53
   106
}
info@53
   107
.input-group-addon:last-child {
info@53
   108
  border-left: 0;
info@53
   109
}
info@53
   110
info@53
   111
// Button input groups
info@53
   112
// -------------------------
info@53
   113
.input-group-btn {
info@53
   114
  position: relative;
info@53
   115
  white-space: nowrap;
info@53
   116
info@53
   117
  // Negative margin to only have a 1px border between the two
info@53
   118
  &:first-child > .btn {
info@53
   119
    margin-right: -1px;
info@53
   120
  }
info@53
   121
  &:last-child > .btn {
info@53
   122
    margin-left: -1px;
info@53
   123
  }
info@53
   124
}
info@53
   125
.input-group-btn > .btn {
info@53
   126
  position: relative;
info@53
   127
  // Jankily prevent input button groups from wrapping
info@53
   128
  + .btn {
info@53
   129
    margin-left: -4px;
info@53
   130
  }
info@53
   131
  // Bring the "active" button to the front
info@53
   132
  &:hover,
info@53
   133
  &:active {
info@53
   134
    z-index: 2;
info@53
   135
  }
info@53
   136
}
Impressum Datenschutzerklärung