_forms.scss 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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. // HTML5 invalid states
  125. // Shares styles with the .control-group.error above
  126. input:focus:invalid,
  127. textarea:focus:invalid,
  128. select:focus:invalid {
  129. color: #b94a48;
  130. border-color: #ee5f5b;
  131. &:focus {
  132. border-color: darken(#ee5f5b, 10%);
  133. $shadow: 0 0 6px lighten(#ee5f5b, 20%);
  134. @include box-shadow($shadow);
  135. }
  136. }
  137. input[type=text].input-fluid {
  138. width: 100%;
  139. box-sizing: border-box;
  140. padding: 10px;
  141. font-size: 16px;
  142. -moz-box-sizing: border-box;
  143. height: 100%;
  144. }
  145. input[type="checkbox"].cr1 {
  146. display: none;
  147. }
  148. .editor-option label.cr1 {
  149. display: inline-block;
  150. margin: 5px 0 1px 0;
  151. }
  152. label.cr1 {
  153. display: inline-block;
  154. height: 18px;
  155. position: relative;
  156. clear: none;
  157. text-indent: 2px;
  158. margin: 0 0 0px 0;
  159. padding: 0 0 0 20px;
  160. vertical-align: top;
  161. background: url($checkboxImageUrl) left top no-repeat;
  162. cursor:pointer;
  163. }
  164. input[type="checkbox"]:checked+label {
  165. background: url($checkboxImageUrl) 0px -18px no-repeat;
  166. }
  167. .gf-fluid-input {
  168. border: none;
  169. display: block;
  170. overflow: hidden;
  171. padding-right: 10px;
  172. input[type=text] {
  173. width: 100%;
  174. padding: 5px 6px;
  175. height: 100%;
  176. box-sizing: border-box;
  177. }
  178. textarea {
  179. width: 100%;
  180. padding: 5px 6px;
  181. height: 100%;
  182. box-sizing: border-box;
  183. }
  184. }
  185. // Form control feedback states
  186. //
  187. // Apply contextual and semantic states to individual form controls.
  188. .form-control-success,
  189. .form-control-warning,
  190. .form-control-danger {
  191. padding-right: ($input-padding-x * 3);
  192. background-repeat: no-repeat;
  193. background-position: center right ($input-height / 4);
  194. background-size: ($input-height / 2) ($input-height / 2);
  195. }
  196. // Form validation states
  197. .has-success {
  198. @include form-control-validation($brand-success);
  199. .form-control-success {
  200. background-image: $form-icon-success;
  201. }
  202. }
  203. .has-warning {
  204. @include form-control-validation($brand-warning);
  205. .form-control-warning {
  206. background-image: $form-icon-warning;
  207. }
  208. }
  209. .has-danger {
  210. @include form-control-validation($brand-danger);
  211. .form-control-danger {
  212. background-image: $form-icon-danger;
  213. }
  214. }