form.pcss.css

Same filename in this branch
  1. 9 core/themes/olivero/css/components/form.pcss.css
Same filename in other branches
  1. 8.9.x core/themes/claro/css/components/form.pcss.css
  2. 10 core/misc/dialog/off-canvas/css/form.pcss.css
  3. 10 core/themes/olivero/css/components/form.pcss.css
  4. 10 core/themes/claro/css/components/form.pcss.css
  5. 11.x core/misc/dialog/off-canvas/css/form.pcss.css
  6. 11.x core/themes/olivero/css/components/form.pcss.css
  7. 11.x core/themes/claro/css/components/form.pcss.css

Main form and form item styles.

File

core/themes/claro/css/components/form.pcss.css

View source
  1. /**
  2. * @file
  3. * Main form and form item styles.
  4. */
  5. @import "../base/variables.pcss.css";
  6. ::placeholder {
  7. opacity: 1;
  8. color: var(--input-fg-color--placeholder);
  9. }
  10. /* IE 10 and 11 needs this set as important. */
  11. :-ms-input-placeholder {
  12. color: var(--input-fg-color--placeholder) !important;
  13. }
  14. /**
  15. * General form item.
  16. */
  17. .form-item {
  18. margin-top: var(--space-l);
  19. margin-bottom: var(--space-l);
  20. }
  21. /**
  22. * When a table row or a container-inline has a single form item, prevent it
  23. * from adding unnecessary extra spacing.
  24. * If it has multiple form items, allow spacing between them, overriding Classy.
  25. */
  26. tr .form-item,
  27. .container-inline .form-item {
  28. margin-top: var(--space-s);
  29. margin-bottom: var(--space-s);
  30. }
  31. /**
  32. * Form element label.
  33. */
  34. .form-item__label {
  35. display: table;
  36. margin-top: calc(var(--space-xs) / 2); /* 4px */
  37. margin-bottom: calc(var(--space-xs) / 2); /* 4px */
  38. font-size: var(--font-size-s); /* ~14px */
  39. font-weight: bold;
  40. line-height: var(--line-height-form-label);
  41. }
  42. .form-item__label--multiple-value-form {
  43. margin-top: 0;
  44. margin-bottom: 0;
  45. font-size: inherit;
  46. font-weight: inherit;
  47. line-height: inherit;
  48. }
  49. .form-item__label[for] {
  50. cursor: pointer;
  51. }
  52. .form-item__label.option {
  53. display: inline;
  54. font-weight: normal;
  55. }
  56. /* Label states. */
  57. .form-item__label.has-error {
  58. color: var(--input--error-color);
  59. }
  60. .form-item__label.option.has-error {
  61. color: inherit;
  62. }
  63. .form-item__label.is-disabled {
  64. cursor: default; /* @todo ...or auto? */
  65. color: var(--input--disabled-fg-color);
  66. }
  67. .form-item__label.form-required::after,
  68. .fieldset__label.form-required::after {
  69. display: inline-block;
  70. margin-right: 0.15em;
  71. margin-left: 0.15em;
  72. content: "*";
  73. color: var(--color-maximumred);
  74. font-size: 0.875rem;
  75. }
  76. /**
  77. * Form item description.
  78. */
  79. .form-item__description {
  80. margin-top: calc(6rem / 16); /* 6px */
  81. margin-bottom: calc(6rem / 16); /* 6px */
  82. color: var(--input-fg-color--description);
  83. font-size: var(--font-size-xs); /* ~13px */
  84. line-height: calc(17rem / 16); /* 17px */
  85. }
  86. /* Description states. */
  87. .form-item__description.is-disabled {
  88. color: var(--input--disabled-fg-color);
  89. }
  90. /**
  91. * Error message (Inline form errors).
  92. */
  93. .form-item__error-message {
  94. margin-top: calc(6rem / 16); /* 6px */
  95. margin-bottom: calc(6rem / 16); /* 6px */
  96. color: var(--input--error-color);
  97. font-size: var(--font-size-xs); /* ~13px */
  98. font-weight: normal;
  99. line-height: calc(17rem / 16); /* 17px */
  100. }
  101. .form-item__prefix.is-disabled,
  102. .form-item__suffix.is-disabled {
  103. color: var(--input--disabled-fg-color);
  104. }
  105. /* Add some spacing so that the focus ring and suffix don't overlap. */
  106. @media screen and (min-width: 601px) {
  107. .form-item__suffix {
  108. margin-left: var(--space-xs); /* LTR */
  109. }
  110. [dir="rtl"] .form-item__suffix {
  111. margin-right: var(--space-xs);
  112. margin-left: 0;
  113. }
  114. }
  115. /**
  116. * Form actions.
  117. */
  118. .form-actions {
  119. display: flex;
  120. flex-wrap: wrap;
  121. align-items: flex-start;
  122. margin-top: var(--space-m);
  123. margin-bottom: var(--space-m);
  124. }
  125. .form-actions .button,
  126. .form-actions .action-link {
  127. margin-top: var(--space-m);
  128. margin-bottom: var(--space-m);
  129. }
  130. .form-actions .ajax-progress--throbber {
  131. align-self: center;
  132. }
  133. /**
  134. * Password module.
  135. *
  136. * @legacy
  137. * @todo These should be in a standalone component file.
  138. */
  139. .confirm-parent,
  140. .password-parent {
  141. overflow: visible;
  142. width: auto;
  143. }
  144. .form-item-options-group-info-identifier,
  145. .form-item-pass .description {
  146. clear: both;
  147. }
  148. /**
  149. * Custom label placement for editor filter format select.
  150. */
  151. .form-item--editor-format {
  152. display: flex;
  153. flex-wrap: wrap;
  154. align-items: center;
  155. max-width: 100%;
  156. }
  157. .form-item--editor-format .form-item__label,
  158. .form-item--editor-format .form-item__prefix,
  159. .form-item--editor-format .form-item__suffix,
  160. .form-item--editor-format .form-element--editor-format {
  161. min-width: 1px;
  162. }
  163. .form-item--editor-format .form-item__label,
  164. .form-item--editor-format .form-item__prefix,
  165. .form-item--editor-format .form-item__suffix {
  166. margin-right: var(--space-xs); /* LTR */
  167. }
  168. [dir="rtl"] .form-item--editor-format .form-item__label,
  169. [dir="rtl"] .form-item--editor-format .form-item__prefix,
  170. [dir="rtl"] .form-item--editor-format .form-item__suffix {
  171. margin-right: 0;
  172. margin-left: var(--space-xs);
  173. }
  174. .form-item--editor-format .form-item__description,
  175. .form-item--editor-format .form-item__error-message {
  176. flex: 0 1 100%;
  177. min-width: 1px;
  178. }
  179. /**
  180. * Improve form element usability on narrow devices.
  181. *
  182. * @legacy
  183. */
  184. @media screen and (max-width: 600px) {
  185. .password-strength {
  186. width: 100%;
  187. }
  188. div.form-item div.password-suggestions {
  189. float: none;
  190. }
  191. }
  192. /**
  193. * Prevent regression due to explicit line-heights applied to these elements in
  194. * normalize.css 7.0.0.
  195. */
  196. button {
  197. line-height: 1.125rem;
  198. }
  199. input,
  200. optgroup {
  201. line-height: 1.5rem;
  202. }
  203. /**
  204. * Prevent regression due to -webkit-appearance being set to button in
  205. * normalize.css 4.1.0.
  206. */
  207. ::-webkit-file-upload-button {
  208. -webkit-appearance: push-button;
  209. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.