_forms.scss 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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-dark;
  15. border: 0;
  16. border-bottom: 1px solid #e5e5e5;
  17. // Small
  18. small {
  19. font-size: $line-height-base * .75;
  20. color: $gray-light;
  21. }
  22. }
  23. // Set font for forms
  24. label,
  25. input,
  26. button,
  27. select,
  28. textarea {
  29. @include font-shorthand($font-size-base,normal,$line-height-base); // Set size, weight, line-height here
  30. }
  31. input,
  32. button,
  33. select,
  34. textarea {
  35. font-family: $font-family-base; // And only set font-family here for those that need it (note the missing label element)
  36. }
  37. // Identify controls by their labels
  38. label {
  39. display: block;
  40. }
  41. // // Form controls
  42. // // -------------------------
  43. //
  44. // // Shared size and type resets
  45. // select,
  46. // textarea,
  47. // input[type="text"],
  48. // input[type="password"],
  49. // input[type="datetime"],
  50. // input[type="datetime-local"],
  51. // input[type="date"],
  52. // input[type="month"],
  53. // input[type="time"],
  54. // input[type="week"],
  55. // input[type="number"],
  56. // input[type="email"],
  57. // input[type="url"],
  58. // input[type="search"],
  59. // input[type="tel"],
  60. // input[type="color"],
  61. // .uneditable-input {
  62. // display: inline-block;
  63. // height: $input-height;
  64. // line-height: $input-line-height;
  65. // padding: 4px 6px;
  66. // font-size: $font-size-base;
  67. // color: $input-color;
  68. // vertical-align: top;
  69. // }
  70. // Reset height since textareas have rows
  71. textarea {
  72. height: auto;
  73. }
  74. // // Everything else
  75. // textarea,
  76. // input[type="text"],
  77. // input[type="password"],
  78. // input[type="datetime"],
  79. // input[type="datetime-local"],
  80. // input[type="date"],
  81. // input[type="month"],
  82. // input[type="time"],
  83. // input[type="week"],
  84. // input[type="number"],
  85. // input[type="email"],
  86. // input[type="url"],
  87. // input[type="search"],
  88. // input[type="tel"],
  89. // input[type="color"] {
  90. // background-color: $input-bg;
  91. // border: 1px solid $input-border-color;
  92. // @include box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
  93. // @include transition("border linear .2s, box-shadow linear .2s");
  94. //
  95. // // Focus state
  96. // &:focus {
  97. // border-color: rgba(82,168,236, .8);
  98. // outline: 0;
  99. // @include box-shadow("inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)");
  100. // }
  101. // }
  102. // Reset width of input images, buttons, radios, checkboxes
  103. input[type="file"],
  104. input[type="image"],
  105. input[type="submit"],
  106. input[type="reset"],
  107. input[type="button"],
  108. input[type="radio"],
  109. input[type="checkbox"] {
  110. width: auto; // Override of generic input selector
  111. }
  112. // Set the height of select and file controls to match text inputs
  113. select,
  114. input[type="file"] {
  115. height: $input-height; /* In IE7, the height of the select element cannot be changed by height, only font-size */
  116. line-height: $input-height;
  117. }
  118. // Make select elements obey height by applying a border
  119. select {
  120. width: 220px; // default input width + 10px of padding that doesn't get applied
  121. border: 1px solid $input-border-color;
  122. background-color: $input-bg; // Chrome on Linux and Mobile Safari need background-color
  123. }
  124. // Make multiple select elements height not fixed
  125. select[multiple],
  126. select[size] {
  127. height: auto;
  128. }
  129. // Focus for select, file, radio, and checkbox
  130. select:focus,
  131. input[type="file"]:focus,
  132. input[type="radio"]:focus,
  133. input[type="checkbox"]:focus {
  134. @include tab-focus();
  135. }
  136. // Placeholder
  137. // -------------------------
  138. // Placeholder text gets special styles because when browsers invalidate entire lines if it doesn't understand a selector
  139. input,
  140. textarea {
  141. @include placeholder();
  142. }
  143. // INPUT SIZES
  144. // -----------
  145. // General classes for quick sizes
  146. .input-mini { width: 60px; }
  147. .input-small { width: 90px; }
  148. .input-medium { width: 150px; }
  149. .input-large { width: 210px; }
  150. .input-xlarge { width: 270px; }
  151. .input-xxlarge { width: 530px; }
  152. // GRID SIZING FOR INPUTS
  153. // ----------------------
  154. // DISABLED STATE
  155. // --------------
  156. // Disabled and read-only inputs
  157. input[disabled],
  158. select[disabled],
  159. textarea[disabled],
  160. input[readonly],
  161. select[readonly],
  162. textarea[readonly] {
  163. cursor: $cursor-disabled;
  164. background-color: $input-bg-disabled;
  165. }
  166. // Explicitly reset the colors here
  167. input[type="radio"][disabled],
  168. input[type="checkbox"][disabled],
  169. input[type="radio"][readonly],
  170. input[type="checkbox"][readonly] {
  171. cursor: $cursor-disabled;
  172. background-color: transparent;
  173. }
  174. // HTML5 invalid states
  175. // Shares styles with the .control-group.error above
  176. input:focus:invalid,
  177. textarea:focus:invalid,
  178. select:focus:invalid {
  179. color: #b94a48;
  180. border-color: #ee5f5b;
  181. &:focus {
  182. border-color: darken(#ee5f5b, 10%);
  183. $shadow: 0 0 6px lighten(#ee5f5b, 20%);
  184. @include box-shadow($shadow);
  185. }
  186. }
  187. input[type=text].input-fluid {
  188. width: 100%;
  189. box-sizing: border-box;
  190. padding: 10px;
  191. font-size: 16px;
  192. -moz-box-sizing: border-box;
  193. height: 100%;
  194. }
  195. input[type="checkbox"].cr1 {
  196. display: none;
  197. }
  198. .editor-option label.cr1 {
  199. display: inline-block;
  200. margin: 5px 0 1px 0;
  201. }
  202. label.cr1 {
  203. display: inline-block;
  204. height: 19px;
  205. position: relative;
  206. clear: none;
  207. text-indent: 2px;
  208. margin: 0 0 0px 0;
  209. padding: 0 0 0 20px;
  210. vertical-align: top;
  211. background: url($checkboxImageUrl) left top no-repeat;
  212. cursor:pointer;
  213. }
  214. input[type="checkbox"]:checked+label {
  215. background: url($checkboxImageUrl) 0px -21px no-repeat;
  216. }
  217. .gf-fluid-input {
  218. border: none;
  219. display: block;
  220. overflow: hidden;
  221. padding-right: 10px;
  222. input[type=text] {
  223. width: 100%;
  224. padding: 5px 6px;
  225. height: 100%;
  226. box-sizing: border-box;
  227. }
  228. textarea {
  229. width: 100%;
  230. padding: 5px 6px;
  231. height: 100%;
  232. box-sizing: border-box;
  233. }
  234. }
  235. // Form control feedback states
  236. //
  237. // Apply contextual and semantic states to individual form controls.
  238. .form-control-success,
  239. .form-control-warning,
  240. .form-control-danger {
  241. padding-right: ($input-padding-x * 3);
  242. background-repeat: no-repeat;
  243. background-position: center right ($input-height / 4);
  244. background-size: ($input-height / 2) ($input-height / 2);
  245. }
  246. // Form validation states
  247. .has-success {
  248. @include form-control-validation($brand-success);
  249. .form-control-success {
  250. background-image: $form-icon-success;
  251. }
  252. }
  253. .has-warning {
  254. @include form-control-validation($brand-warning);
  255. .form-control-warning {
  256. background-image: $form-icon-warning;
  257. }
  258. }
  259. .has-danger {
  260. @include form-control-validation($brand-danger);
  261. .form-control-danger {
  262. background-image: $form-icon-danger;
  263. }
  264. }