2
0

_forms.scss 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. // These are the generic stylings for forms of any type.
  2. // If you're styling something specific to the page editing interface,
  3. // it probably ought to go in layouts/page-editor.scss
  4. form {
  5. ul,
  6. li {
  7. list-style-type: none;
  8. }
  9. ul {
  10. margin: 0;
  11. padding: 0;
  12. }
  13. }
  14. fieldset {
  15. border: 0;
  16. padding: 0 0 2em;
  17. margin: 0;
  18. }
  19. legend {
  20. @include visuallyhidden();
  21. }
  22. label,
  23. .label {
  24. text-transform: none;
  25. font-weight: bold;
  26. color: $color-grey-1;
  27. font-size: 1.1em;
  28. display: block;
  29. padding: 0 0 0.8em;
  30. margin: 0;
  31. line-height: 1.3em;
  32. .checkbox &,
  33. .radio & {
  34. display: inline;
  35. }
  36. &.no-float {
  37. float: none;
  38. }
  39. @include media-breakpoint-up(sm) {
  40. @include column(2);
  41. padding-top: 1.2em;
  42. padding-left: 0;
  43. .radio_select &,
  44. .model_multiple_choice_field &,
  45. .boolean_field &,
  46. .model_choice_field &,
  47. .image_field & {
  48. padding-top: 0;
  49. }
  50. // Horrid specificity war
  51. .model_choice_field.select & {
  52. padding-top: 1.2em;
  53. }
  54. }
  55. }
  56. // Provide a way to "unfloat" all form elements
  57. .no-float-elements {
  58. label,
  59. .label {
  60. display: block;
  61. float: none;
  62. padding: 1.2em 0 0.8em;
  63. width: auto;
  64. }
  65. li > label,
  66. li > .label {
  67. padding-top: 0;
  68. }
  69. .helptext {
  70. display: inline-block;
  71. margin-bottom: 0.8em;
  72. }
  73. }
  74. input:not([type=submit]),
  75. textarea,
  76. select,
  77. .halloeditor,
  78. .tagit {
  79. appearance: none;
  80. box-sizing: border-box;
  81. border-radius: 6px;
  82. width: 100%;
  83. font-family: Open Sans,Arial,sans-serif;
  84. border: 1px solid $color-input-border;
  85. padding: 0.9em 1.2em;
  86. background-color: $color-fieldset-hover;
  87. color: $color-text-input;
  88. font-size: 1.2em;
  89. font-weight: 300;
  90. &:hover {
  91. background-color: $color-white;
  92. }
  93. &:focus {
  94. background-color: $color-input-focus;
  95. border-color: $color-input-focus-border;
  96. }
  97. &:disabled,
  98. &[disabled],
  99. &:disabled:hover,
  100. &[disabled]:hover {
  101. background-color: $color-grey-4;
  102. cursor: not-allowed;
  103. color: $color-grey-2;
  104. }
  105. }
  106. // Reset the arrow on `<select>`s in IE10+.
  107. select::-ms-expand {
  108. display: none;
  109. }
  110. .file_field {
  111. .input {
  112. label {
  113. float: none;
  114. display: inline;
  115. padding: 0;
  116. }
  117. input[type=checkbox] {
  118. margin-top: 5px;
  119. }
  120. a {
  121. &:after {
  122. content: ' ';
  123. display: block;
  124. }
  125. }
  126. }
  127. }
  128. // radio and check boxes
  129. input[type=radio],
  130. input[type=checkbox] {
  131. border-radius: 0;
  132. cursor: pointer;
  133. border: 0;
  134. padding: 0;
  135. }
  136. input[type=radio] {
  137. height: 12px;
  138. width: auto;
  139. position: relative;
  140. margin-right: 27px;
  141. }
  142. input[type=radio]:before {
  143. border-radius: 100%;
  144. font-family: wagtail;
  145. font-style: normal;
  146. text-align: center;
  147. position: absolute;
  148. top: -5px;
  149. left: -2px;
  150. cursor: pointer;
  151. display: block;
  152. content: map-get($icons, 'radio-full');
  153. width: 1em;
  154. height: 1em;
  155. line-height: 1.1em;
  156. padding: 4px;
  157. background-color: $color-white;
  158. color: $color-grey-4;
  159. border: 1px solid $color-grey-4;
  160. }
  161. input[type=radio]:checked:before {
  162. content: map-get($icons, 'radio-full');
  163. color: $color-teal;
  164. }
  165. input[type=checkbox] {
  166. height: 12px;
  167. width: auto;
  168. position: relative;
  169. margin-right: 27px;
  170. }
  171. input[type=checkbox]:before {
  172. font-family: wagtail;
  173. font-style: normal;
  174. text-align: center;
  175. position: absolute;
  176. top: -5px;
  177. cursor: pointer;
  178. display: block;
  179. content: map-get($icons, 'tick');
  180. line-height: 20px;
  181. width: 20px;
  182. height: 20px;
  183. background-color: $color-white;
  184. border: 1px solid $color-grey-4;
  185. color: $color-white;
  186. }
  187. input[type=checkbox]:checked:before {
  188. color: $color-teal;
  189. }
  190. // Special styles to counteract Firefox's completely unwarranted assumptions about button styles
  191. input[type=submit],
  192. input[type=reset],
  193. input[type=button],
  194. button {
  195. padding: 0 1em;
  196. @include media-breakpoint-up(sm) {
  197. &.button-small {
  198. height: 2em;
  199. }
  200. }
  201. }
  202. // Transitions
  203. fieldset,
  204. input,
  205. textarea,
  206. select {
  207. @include transition(background-color 0.2s ease);
  208. }