_forms.scss 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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 * .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-base; // 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 { width: 60px; }
  106. .input-small { width: 90px; }
  107. .input-medium { width: 150px; }
  108. .input-large { width: 210px; }
  109. .input-xlarge { width: 270px; }
  110. .input-xxlarge { width: 530px; }
  111. // GRID SIZING FOR INPUTS
  112. // ----------------------
  113. // DISABLED STATE
  114. // --------------
  115. // Disabled and read-only inputs
  116. input[disabled],
  117. select[disabled],
  118. textarea[disabled],
  119. input[readonly],
  120. select[readonly],
  121. textarea[readonly] {
  122. cursor: $cursor-disabled;
  123. background-color: $input-bg-disabled;
  124. }
  125. // Explicitly reset the colors here
  126. input[type="radio"][disabled],
  127. input[type="checkbox"][disabled],
  128. input[type="radio"][readonly],
  129. input[type="checkbox"][readonly] {
  130. cursor: $cursor-disabled;
  131. background-color: transparent;
  132. }
  133. input[type=text].input-fluid {
  134. width: 100%;
  135. box-sizing: border-box;
  136. padding: 10px;
  137. font-size: 16px;
  138. -moz-box-sizing: border-box;
  139. height: 100%;
  140. }
  141. input[type="checkbox"].cr1 {
  142. display: none;
  143. }
  144. .editor-option label.cr1 {
  145. display: inline-block;
  146. margin: 5px 0 1px 0;
  147. }
  148. label.cr1 {
  149. display: inline-block;
  150. height: 18px;
  151. position: relative;
  152. clear: none;
  153. text-indent: 2px;
  154. margin: 0 0 0px 0;
  155. padding: 0 0 0 20px;
  156. vertical-align: top;
  157. background: url($checkboxImageUrl) left top no-repeat;
  158. cursor:pointer;
  159. }
  160. input[type="checkbox"].cr1:checked+label {
  161. background: url($checkboxImageUrl) 0px -18px no-repeat;
  162. }
  163. .gf-fluid-input {
  164. border: none;
  165. display: block;
  166. overflow: hidden;
  167. padding-right: 10px;
  168. input[type=text] {
  169. width: 100%;
  170. padding: 5px 6px;
  171. height: 100%;
  172. box-sizing: border-box;
  173. }
  174. textarea {
  175. width: 100%;
  176. padding: 5px 6px;
  177. height: 100%;
  178. box-sizing: border-box;
  179. }
  180. }
  181. // Form control feedback states
  182. //
  183. // Apply contextual and semantic states to individual form controls.
  184. .form-control-success,
  185. .form-control-warning,
  186. .form-control-danger {
  187. padding-right: ($input-padding-x * 3);
  188. background-repeat: no-repeat;
  189. background-position: center right ($input-height / 4);
  190. background-size: ($input-height / 2) ($input-height / 2);
  191. }
  192. // Form validation states
  193. .has-success {
  194. @include form-control-validation($brand-success);
  195. .form-control-success {
  196. background-image: $form-icon-success;
  197. }
  198. }
  199. .has-warning {
  200. @include form-control-validation($brand-warning);
  201. .form-control-warning {
  202. background-image: $form-icon-warning;
  203. }
  204. }
  205. .has-danger {
  206. @include form-control-validation($brand-danger);
  207. .form-control-danger {
  208. background-image: $form-icon-danger;
  209. }
  210. }