You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
4.2 KiB

10 years ago
10 years ago
9 years ago
10 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
9 years ago
10 years ago
  1. // stylelint-disable selector-no-qualifying-type
  2. //
  3. // Input groups
  4. // --------------------------------------------------
  5. // Base styles
  6. // -------------------------
  7. .input-group {
  8. position: relative; // For dropdowns
  9. display: table;
  10. border-collapse: separate; // prevent input groups from inheriting border styles from table cells when placed within a table
  11. // Undo padding and float of grid classes
  12. &[class*="col-"] {
  13. float: none;
  14. padding-right: 0;
  15. padding-left: 0;
  16. }
  17. .form-control {
  18. // Ensure that the input is always above the *appended* addon button for
  19. // proper border colors.
  20. position: relative;
  21. z-index: 2;
  22. // IE9 fubars the placeholder attribute in text inputs and the arrows on
  23. // select elements in input groups. To fix it, we float the input. Details:
  24. // https://github.com/twbs/bootstrap/issues/11561#issuecomment-28936855
  25. float: left;
  26. width: 100%;
  27. margin-bottom: 0;
  28. &:focus {
  29. z-index: 3;
  30. }
  31. }
  32. }
  33. // Sizing options
  34. //
  35. // Remix the default form control sizing classes into new ones for easier
  36. // manipulation.
  37. .input-group-lg > .form-control,
  38. .input-group-lg > .input-group-addon,
  39. .input-group-lg > .input-group-btn > .btn {
  40. .input-lg();
  41. }
  42. .input-group-sm > .form-control,
  43. .input-group-sm > .input-group-addon,
  44. .input-group-sm > .input-group-btn > .btn {
  45. .input-sm();
  46. }
  47. // Display as table-cell
  48. // -------------------------
  49. .input-group-addon,
  50. .input-group-btn,
  51. .input-group .form-control {
  52. display: table-cell;
  53. &:not(:first-child):not(:last-child) {
  54. border-radius: 0;
  55. }
  56. }
  57. // Addon and addon wrapper for buttons
  58. .input-group-addon,
  59. .input-group-btn {
  60. width: 1%;
  61. white-space: nowrap;
  62. vertical-align: middle; // Match the inputs
  63. }
  64. // Text input groups
  65. // -------------------------
  66. .input-group-addon {
  67. padding: @padding-base-vertical @padding-base-horizontal;
  68. font-size: @font-size-base;
  69. font-weight: 400;
  70. line-height: 1;
  71. color: @input-color;
  72. text-align: center;
  73. background-color: @input-group-addon-bg;
  74. border: 1px solid @input-group-addon-border-color;
  75. border-radius: @input-border-radius;
  76. // Sizing
  77. &.input-sm {
  78. padding: @padding-small-vertical @padding-small-horizontal;
  79. font-size: @font-size-small;
  80. border-radius: @input-border-radius-small;
  81. }
  82. &.input-lg {
  83. padding: @padding-large-vertical @padding-large-horizontal;
  84. font-size: @font-size-large;
  85. border-radius: @input-border-radius-large;
  86. }
  87. // Nuke default margins from checkboxes and radios to vertically center within.
  88. input[type="radio"],
  89. input[type="checkbox"] {
  90. margin-top: 0;
  91. }
  92. }
  93. // Reset rounded corners
  94. .input-group .form-control:first-child,
  95. .input-group-addon:first-child,
  96. .input-group-btn:first-child > .btn,
  97. .input-group-btn:first-child > .btn-group > .btn,
  98. .input-group-btn:first-child > .dropdown-toggle,
  99. .input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
  100. .input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
  101. .border-right-radius(0);
  102. }
  103. .input-group-addon:first-child {
  104. border-right: 0;
  105. }
  106. .input-group .form-control:last-child,
  107. .input-group-addon:last-child,
  108. .input-group-btn:last-child > .btn,
  109. .input-group-btn:last-child > .btn-group > .btn,
  110. .input-group-btn:last-child > .dropdown-toggle,
  111. .input-group-btn:first-child > .btn:not(:first-child),
  112. .input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
  113. .border-left-radius(0);
  114. }
  115. .input-group-addon:last-child {
  116. border-left: 0;
  117. }
  118. // Button input groups
  119. // -------------------------
  120. .input-group-btn {
  121. position: relative;
  122. // Jankily prevent input button groups from wrapping with `white-space` and
  123. // `font-size` in combination with `inline-block` on buttons.
  124. font-size: 0;
  125. white-space: nowrap;
  126. // Negative margin for spacing, position for bringing hovered/focused/actived
  127. // element above the siblings.
  128. > .btn {
  129. position: relative;
  130. + .btn {
  131. margin-left: -1px;
  132. }
  133. // Bring the "active" button to the front
  134. &:hover,
  135. &:focus,
  136. &:active {
  137. z-index: 2;
  138. }
  139. }
  140. // Negative margin to only have a 1px border between the two
  141. &:first-child {
  142. > .btn,
  143. > .btn-group {
  144. margin-right: -1px;
  145. }
  146. }
  147. &:last-child {
  148. > .btn,
  149. > .btn-group {
  150. z-index: 2;
  151. margin-left: -1px;
  152. }
  153. }
  154. }