_forms.scss 4.5 KB

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