Nenhuma descrição

input-groups.less 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. }