_forms.scss 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. //
  2. // Forms
  3. // --------------------------------------------------
  4. // GENERAL STYLES
  5. // --------------
  6. // Groups of fields with labels on top (legends)
  7. legend {
  8. display: block;
  9. width: 100%;
  10. padding: 0;
  11. margin-bottom: $line-height-base;
  12. font-size: $font-size-base * 1.5;
  13. line-height: $line-height-base * 2;
  14. color: $gray-3;
  15. border: 0;
  16. border-bottom: 1px solid #e5e5e5;
  17. // Small
  18. small {
  19. font-size: $line-height-base * 0.75;
  20. color: $gray-2;
  21. }
  22. }
  23. // Reset height since textareas have rows
  24. // Set font for forms
  25. label,
  26. input,
  27. button,
  28. select,
  29. textarea {
  30. @include font-shorthand($font-size-base, normal, $line-height-base); // Set size, weight, line-height here
  31. }
  32. input,
  33. button,
  34. select,
  35. textarea {
  36. font-family: $font-family-sans-serif; // And only set font-family here for those that need it (note the missing label element)
  37. }
  38. // Identify controls by their labels
  39. label {
  40. display: block;
  41. }
  42. input,
  43. select {
  44. background-color: $input-bg;
  45. color: $input-color;
  46. border: none;
  47. box-shadow: none;
  48. }
  49. textarea {
  50. height: auto;
  51. }
  52. // Reset width of input images, buttons, radios, checkboxes
  53. input[type='file'],
  54. input[type='image'],
  55. input[type='submit'],
  56. input[type='reset'],
  57. input[type='button'],
  58. input[type='radio'],
  59. input[type='checkbox'] {
  60. width: auto; // Override of generic input selector
  61. }
  62. // Set the height of select and file controls to match text inputs
  63. select,
  64. input[type='file'] {
  65. height: $input-height; /* In IE7, the height of the select element cannot be changed by height, only font-size */
  66. line-height: $input-height;
  67. }
  68. // Make select elements obey height by applying a border
  69. select {
  70. width: 220px; // default input width + 10px of padding that doesn't get applied
  71. border: 1px solid $input-border-color;
  72. background-color: $input-bg; // Chrome on Linux and Mobile Safari need background-color
  73. }
  74. // Make multiple select elements height not fixed
  75. select[multiple],
  76. select[size] {
  77. height: auto;
  78. }
  79. // Focus for select, file, radio, and checkbox
  80. select:focus,
  81. input[type='file']:focus,
  82. input[type='radio']:focus,
  83. input[type='checkbox']:focus {
  84. @include tab-focus();
  85. }
  86. // not a big fan of number fields
  87. input[type='number']::-webkit-outer-spin-button,
  88. input[type='number']::-webkit-inner-spin-button {
  89. -webkit-appearance: none;
  90. margin: 0;
  91. }
  92. input[type='number'] {
  93. -moz-appearance: textfield;
  94. }
  95. // Placeholder
  96. // -------------------------
  97. // Placeholder text gets special styles because when browsers invalidate entire lines if it doesn't understand a selector
  98. input,
  99. textarea {
  100. @include placeholder();
  101. }
  102. // INPUT SIZES
  103. // -----------
  104. // General classes for quick sizes
  105. .input-mini {
  106. width: 60px;
  107. }
  108. .input-small {
  109. width: 90px;
  110. }
  111. .input-medium {
  112. width: 150px;
  113. }
  114. .input-large {
  115. width: 210px;
  116. }
  117. .input-xlarge {
  118. width: 270px;
  119. }
  120. .input-xxlarge {
  121. width: 530px;
  122. }
  123. // GRID SIZING FOR INPUTS
  124. // ----------------------
  125. // DISABLED STATE
  126. // --------------
  127. // Disabled and read-only inputs
  128. input[disabled],
  129. select[disabled],
  130. textarea[disabled],
  131. input[readonly],
  132. select[readonly],
  133. textarea[readonly] {
  134. cursor: $cursor-disabled;
  135. background-color: $input-bg-disabled;
  136. }
  137. // Explicitly reset the colors here
  138. input[type='radio'][disabled],
  139. input[type='checkbox'][disabled],
  140. input[type='radio'][readonly],
  141. input[type='checkbox'][readonly] {
  142. cursor: $cursor-disabled;
  143. background-color: transparent;
  144. }
  145. input[type='text'].input-fluid {
  146. width: 100%;
  147. box-sizing: border-box;
  148. padding: 10px;
  149. font-size: 16px;
  150. -moz-box-sizing: border-box;
  151. height: 100%;
  152. }
  153. input[type='checkbox'].cr1 {
  154. display: none;
  155. }
  156. .editor-option label.cr1 {
  157. display: inline-block;
  158. margin: 5px 0 1px 0;
  159. }
  160. label.cr1 {
  161. display: inline-block;
  162. height: 18px;
  163. position: relative;
  164. clear: none;
  165. text-indent: 2px;
  166. margin: 0 0 0px 0;
  167. padding: 0 0 0 20px;
  168. vertical-align: top;
  169. background: url($checkboxImageUrl) left top no-repeat;
  170. cursor: pointer;
  171. }
  172. input[type='checkbox'].cr1:checked + label {
  173. background: url($checkboxImageUrl) 0px -18px no-repeat;
  174. }
  175. .gf-fluid-input {
  176. border: none;
  177. display: block;
  178. overflow: hidden;
  179. padding-right: 10px;
  180. input[type='text'] {
  181. width: 100%;
  182. padding: 5px 6px;
  183. height: 100%;
  184. box-sizing: border-box;
  185. }
  186. textarea {
  187. width: 100%;
  188. padding: 5px 6px;
  189. height: 100%;
  190. box-sizing: border-box;
  191. }
  192. }
  193. // Form control feedback states
  194. //
  195. // Apply contextual and semantic states to individual form controls.
  196. .form-control-success,
  197. .form-control-warning,
  198. .form-control-danger {
  199. padding-right: ($input-padding-x * 3);
  200. background-repeat: no-repeat;
  201. background-position: center right ($input-height / 4);
  202. background-size: ($input-height / 2) ($input-height / 2);
  203. }
  204. // Form validation states
  205. .has-success {
  206. @include form-control-validation($brand-success);
  207. .form-control-success {
  208. background-image: $form-icon-success;
  209. }
  210. }
  211. .has-warning {
  212. @include form-control-validation($brand-warning);
  213. .form-control-warning {
  214. background-image: $form-icon-warning;
  215. }
  216. }
  217. .has-danger {
  218. @include form-control-validation($brand-danger);
  219. .form-control-danger {
  220. background-image: $form-icon-danger;
  221. }
  222. }