_forms.scss 5.0 KB

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