forms.scss 6.0 KB

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