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.

162 lines
4.3 KiB

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