_forms.scss 4.8 KB

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