_form.scss 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. ///
  2. /// Paradigm Shift by HTML5 UP
  3. /// html5up.net | @ajlkn
  4. /// Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
  5. ///
  6. /* Form */
  7. form {
  8. margin: 0 0 _size(element-margin) 0;
  9. > :last-child {
  10. margin-bottom: 0;
  11. }
  12. > .fields {
  13. $gutter: _size(form-gutter);
  14. @include vendor('display', 'flex');
  15. @include vendor('flex-wrap', 'wrap');
  16. margin: ($gutter * -1) 0 _size(element-margin) ($gutter * -1);
  17. width: calc(100% + #{$gutter * 2});
  18. > .field {
  19. @include vendor('flex-grow', '0');
  20. @include vendor('flex-shrink', '0');
  21. padding: $gutter 0 0 $gutter;
  22. width: calc(100% - #{$gutter * 1});
  23. > :last-child {
  24. margin-bottom: 0;
  25. }
  26. &.half {
  27. width: calc(50% - #{$gutter * 0.5});
  28. }
  29. &.third {
  30. width: calc(#{100% / 3} - #{$gutter * (1 / 3)});
  31. }
  32. &.quarter {
  33. width: calc(25% - #{$gutter * 0.25});
  34. }
  35. }
  36. }
  37. @include breakpoint('<=xsmall') {
  38. > .fields {
  39. $gutter: (_size(element-margin) * 0.75);
  40. margin: ($gutter * -1) 0 _size(element-margin) ($gutter * -1);
  41. width: calc(100% + #{$gutter * 2});
  42. > .field {
  43. padding: $gutter 0 0 $gutter;
  44. width: calc(100% - #{$gutter * 1});
  45. &.half {
  46. width: calc(100% - #{$gutter * 1});
  47. }
  48. &.third {
  49. width: calc(100% - #{$gutter * 1});
  50. }
  51. &.quarter {
  52. width: calc(100% - #{$gutter * 1});
  53. }
  54. }
  55. }
  56. }
  57. }
  58. input[type="text"],
  59. input[type="password"],
  60. input[type="email"],
  61. input[type="tel"],
  62. input[type="search"],
  63. input[type="url"],
  64. select,
  65. textarea {
  66. @include vendor('appearance', 'none');
  67. border-radius: _size(border-radius);
  68. border: solid 2px _palette(border);
  69. color: inherit;
  70. display: block;
  71. outline: 0;
  72. padding: 0 1rem;
  73. text-decoration: none;
  74. width: 100%;
  75. &:invalid {
  76. box-shadow: none;
  77. }
  78. &:focus {
  79. border-color: _palette(accent-alt);
  80. }
  81. }
  82. label {
  83. color: _palette(fg-bold);
  84. display: block;
  85. font-family: _font(family-heading);
  86. font-size: 0.75rem;
  87. font-weight: _font(weight-heading-light);
  88. letter-spacing: _font(kerning-heading);
  89. line-height: 1.75;
  90. margin: 0 0 (_size(element-margin) * 0.5) 0;
  91. text-transform: uppercase;
  92. }
  93. input[type="text"],
  94. input[type="password"],
  95. input[type="email"],
  96. input[type="tel"],
  97. input[type="search"],
  98. input[type="url"] {
  99. height: _size(element-height);
  100. }
  101. select {
  102. background-image: svg-url("<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' preserveAspectRatio='none' viewBox='0 0 40 40'><path d='M9.4,12.3l10.4,10.4l10.4-10.4c0.2-0.2,0.5-0.4,0.9-0.4c0.3,0,0.6,0.1,0.9,0.4l3.3,3.3c0.2,0.2,0.4,0.5,0.4,0.9 c0,0.4-0.1,0.6-0.4,0.9L20.7,31.9c-0.2,0.2-0.5,0.4-0.9,0.4c-0.3,0-0.6-0.1-0.9-0.4L4.3,17.3c-0.2-0.2-0.4-0.5-0.4-0.9 c0-0.4,0.1-0.6,0.4-0.9l3.3-3.3c0.2-0.2,0.5-0.4,0.9-0.4S9.1,12.1,9.4,12.3z' fill='#{_palette(border)}' /></svg>");
  103. background-position: calc(100% - 1rem) center;
  104. background-repeat: no-repeat;
  105. background-size: 1.25rem;
  106. height: _size(element-height);
  107. padding-right: _size(element-height);
  108. text-overflow: ellipsis;
  109. option {
  110. background-color: _palette(bg);
  111. color: _palette(fg);
  112. }
  113. &:focus {
  114. &::-ms-value {
  115. background-color: transparent;
  116. }
  117. }
  118. &::-ms-expand {
  119. display: none;
  120. }
  121. }
  122. textarea {
  123. padding: 0.75rem 1rem;
  124. }
  125. input[type="checkbox"],
  126. input[type="radio"], {
  127. @include vendor('appearance', 'none');
  128. display: block;
  129. float: left;
  130. margin-right: -2rem;
  131. opacity: 0;
  132. width: 1rem;
  133. z-index: -1;
  134. & + label {
  135. @include icon(false, solid);
  136. color: _palette(fg);
  137. cursor: pointer;
  138. display: inline-block;
  139. font-family: _font(family);
  140. font-size: 1rem;
  141. font-weight: _font(weight);
  142. letter-spacing: _font(kerning);
  143. padding-left: (_size(element-height) * 0.6) + 0.875rem;
  144. padding-right: 0.875rem;
  145. position: relative;
  146. text-transform: none;
  147. &:before {
  148. border-radius: _size(border-radius);
  149. border: solid 2px _palette(border);
  150. content: '';
  151. display: inline-block;
  152. font-size: 0.8rem;
  153. height: (_size(element-height) * 0.75);
  154. left: 0;
  155. line-height: (_size(element-height) * 0.75);
  156. position: absolute;
  157. text-align: center;
  158. top: (_size(element-height) * -0.05);
  159. width: (_size(element-height) * 0.75);
  160. }
  161. }
  162. &:checked + label {
  163. &:before {
  164. content: '\f00c';
  165. background-color: _palette(accent);
  166. border-color: _palette(accent);
  167. color: _palette(bg);
  168. }
  169. }
  170. &:focus + label {
  171. &:before {
  172. border-color: _palette(accent);
  173. box-shadow: 0 0 0 1px _palette(accent);
  174. }
  175. }
  176. }
  177. input[type="checkbox"] {
  178. & + label {
  179. &:before {
  180. border-radius: _size(border-radius);
  181. }
  182. }
  183. }
  184. input[type="radio"] {
  185. & + label {
  186. &:before {
  187. border-radius: 100%;
  188. }
  189. }
  190. }
  191. ::-webkit-input-placeholder {
  192. opacity: 1.0;
  193. color: _palette(fg-light) !important;
  194. }
  195. :-moz-placeholder {
  196. opacity: 1.0;
  197. color: _palette(fg-light) !important;
  198. }
  199. ::-moz-placeholder {
  200. opacity: 1.0;
  201. color: _palette(fg-light) !important;
  202. }
  203. :-ms-input-placeholder {
  204. opacity: 1.0;
  205. color: _palette(fg-light) !important;
  206. }
  207. @include breakpoint('<=small') {
  208. label {
  209. font-size: 0.675rem;
  210. }
  211. input[type="checkbox"],
  212. input[type="radio"] {
  213. & + label {
  214. font-size: 1rem;
  215. }
  216. }
  217. }
  218. @include breakpoint('<=xxsmall') {
  219. label {
  220. font-size: 0.675rem;
  221. }
  222. input[type="checkbox"],
  223. input[type="radio"] {
  224. & + label {
  225. font-size: 1rem;
  226. }
  227. }
  228. }