form.css

Same filename in this branch
  1. 9 core/profiles/demo_umami/themes/umami/css/classy/components/form.css
  2. 9 core/themes/olivero/css/components/form.css
  3. 9 core/themes/seven/css/classy/components/form.css
  4. 9 core/themes/claro/css/components/form.css
  5. 9 core/themes/bartik/css/components/form.css
  6. 9 core/themes/bartik/css/classy/components/form.css
  7. 9 core/themes/starterkit_theme/css/components/form.css
  8. 9 core/themes/classy/css/components/form.css
Same filename in other branches
  1. 8.9.x core/profiles/demo_umami/themes/umami/css/classy/components/form.css
  2. 8.9.x core/themes/seven/css/components/form.css
  3. 8.9.x core/themes/seven/css/classy/components/form.css
  4. 8.9.x core/themes/claro/css/components/form.css
  5. 8.9.x core/themes/bartik/css/components/form.css
  6. 8.9.x core/themes/bartik/css/classy/components/form.css
  7. 8.9.x core/themes/classy/css/components/form.css
  8. 10 core/profiles/demo_umami/themes/umami/css/components/forms/form.css
  9. 10 core/misc/dialog/off-canvas/css/form.css
  10. 10 core/themes/olivero/css/components/form.css
  11. 10 core/themes/claro/css/components/form.css
  12. 10 core/themes/starterkit_theme/css/components/form.css
  13. 11.x core/profiles/demo_umami/themes/umami/css/components/forms/form.css
  14. 11.x core/misc/dialog/off-canvas/css/form.css
  15. 11.x core/themes/olivero/css/components/form.css
  16. 11.x core/themes/claro/css/components/form.css
  17. 11.x core/themes/starterkit_theme/css/components/form.css
/**
 * Form elements.
 */
form {
  margin: 0;
  padding: 0;
}

/**
 * Prevent regression due to explicit line-height and font-size applied to these
 * elements in normalize.css 7.0.0.
 */
button:not(.button),
input:not([type="file"]):not(.form-text):not(.form-textarea) {
  line-height: 1.25em;
}
textarea,
input[type="search"],
input[type="number"],
input[type="email"] {
  line-height: normal;
}
select {
  font-size: 0.8125rem;
  line-height: 1.42902em;
}
details select {
  line-height: 1.20324em;
}

/**
 * Prevent regression due to fieldset styling that was removed in normalize.css
 * 6.0.0.
 */
fieldset {
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
  border: 1px solid #c0c0c0;
}
fieldset:not(.fieldgroup) {
  position: relative;
  min-width: 0;
  margin: 1em 0;
  padding: 30px 18px 18px;
  border-radius: 2px;
  background-color: #fcfcfa;
}
fieldset:not(.fieldgroup) > legend {
  position: absolute;
  top: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1em;
  font-weight: bold;
}
.fieldgroup {
  min-width: 0;
}
.form-item {
  margin: 0.75em 0;
}
/**
 * When a table row has a single form item, prevent it from adding unnecessary
 * extra spacing. If it has multiple form items, allow spacing between them,
 * overriding Classy.
 */
tr.odd .form-item,
tr.even .form-item {
  margin-top: 0.75em;
  margin-bottom: 0.75em;
}
td > .form-item:only-child {
  margin-top: 0;
  margin-bottom: 0;
}
.form-type-checkbox {
  padding: 0;
}
label {
  display: table;
  margin: 0 0 0.1em;
  padding: 0;
  font-weight: bold;
}
label.error {
  color: #a51b00;
}
label[for] {
  cursor: pointer;
}
.form-item label.option {
  text-transform: none;
}
.form-item label.option input {
  vertical-align: middle;
}
.form-disabled label {
  color: #686868;
}
.form-disabled input.form-date,
.form-disabled input.form-text,
.form-disabled input.form-tel,
.form-disabled input.form-time,
.form-disabled input.form-email,
.form-disabled input.form-url,
.form-disabled input.form-search,
.form-disabled input.form-number,
.form-disabled input.form-color,
.form-disabled input.form-file,
.form-disabled textarea.form-textarea,
.form-disabled select.form-select {
  border-color: #d4d4d4;
  background-color: hsla(0, 0%, 0%, 0.08);
  box-shadow: none;
}
.form-item input.error,
.form-item textarea.error,
.form-item select.error {
  color: #a51b00;
  border-width: 1px;
  border-color: #e62600;
  background-color: hsla(15, 75%, 97%, 1);
  box-shadow: inset 0 5px 5px -5px #b8b8b8;
}
.form-item textarea.error + .cke {
  border-width: 1px;
  border-color: #e62600;
}
.form-item textarea.error + .ck-editor > .ck-editor__main {
  border: 1px solid #e62600;
}
.form-item input.error:focus,
.form-item textarea.error:focus,
.form-item select.error:focus {
  border-color: #e62600;
  outline: 0;
  background-color: #fcf4f2;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 8px 1px #e62600;
}
.form-required:after {
  width: 7px;
  height: 7px;
  background-size: 7px 7px;
}
.form-item--error-message {
  margin-top: 0.15em;
  color: #e32700;
}
.fieldset-wrapper > .form-item--error-message {
  margin-top: 0;
}
.text-format-wrapper .form-item--error-message {
  margin: 0;
  padding: 0.25em 0.666em 0;
  border: solid #ccc;
  border-width: 0 1px;
}

/* Filter */
ul.tips,
div.description,
.form-item .description {
  margin: 0.2em 0 0 0;
  color: #595959;
  font-size: 0.95em;
}
.form-item .description.error {
  margin-top: 0;
  color: #a51b00;
}

ul.tips li {
  margin: 0.25em 0 0.25em 1.5em; /* LTR */
}
[dir="rtl"] ul.tips li {
  margin: 0.25em 1.5em 0.25em 0;
}
.form-type-radio .description,
.form-type-checkbox .description {
  margin-left: 1.5em; /* LTR */
}
[dir="rtl"] .form-type-radio .description,
[dir="rtl"] .form-type-checkbox .description {
  margin-right: 1.5em;
  margin-left: 0;
}
.form-text,
.form-textarea {
  border-radius: 2px;
  font-size: 1em;
  line-height: normal;
}

input.form-autocomplete,
input.form-text,
input.form-tel,
input.form-email,
input.form-url,
input.form-search,
input.form-number,
input.form-color,
input.form-file,
input.form-date,
input.form-time,
textarea.form-textarea {
  box-sizing: border-box;
  max-width: 100%;
  padding: 0.3em 0.4em 0.3em 0.5em; /* LTR */
  -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
  transition: border linear 0.2s, box-shadow linear 0.2s;
  color: #595959;
  border: 1px solid #b8b8b8;
  border-top-color: #999;
  border-radius: 2px;
  background: #fcfcfa;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.125);
  font-size: 1em;
}
[dir="rtl"] textarea.form-textarea {
  padding: 0.3em 0.5em 0.3em 0.4em;
}
.form-text:focus,
.form-tel:focus,
.form-email:focus,
.form-url:focus,
.form-search:focus,
.form-number:focus,
.form-color:focus,
.form-file:focus,
.form-textarea:focus,
.form-date:focus,
.form-time:focus {
  border-color: #40b6ff;
  outline: 0;
  background-color: #fff;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 8px #40b6ff;
}

.confirm-parent,
.password-parent {
  overflow: visible;
  width: auto;
}

.form-item-options-group-info-identifier,
.form-item-pass .description {
  clear: both;
}

/**
 * Limits extra long instances of select elements to the max width allowed
 * to avoid breaking layouts.
 */
select {
  max-width: 100%;
}

/**
 * Select elements - Webkit only
 */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select {
    padding: 1px 1.571em 1px 0.5em; /* LTR */
    cursor: pointer;
    -webkit-transition: all 0.1s;
    transition: all 0.1s;
    border: 1px solid #a6a6a6;
    border-radius: 0.143em;
    background:
      url(../../../../misc/icons/333333/caret-down.svg) no-repeat 99% 63%,
      -webkit-linear-gradient(top, #f6f6f3, #e7e7df); /* LTR */

    text-shadow: 0 1px hsla(0, 0%, 100%, 0.6);
    font-size: 0.875rem;
    -webkit-appearance: none;
    -webkit-font-smoothing: antialiased;
  }
  [dir="rtl"] select {
    padding: 1px 0.714em 1px 1.571em;
    background-position: 1% 63%, 0 0;
  }
  select:focus,
  select:hover {
    color: #1a1a1a;
    background-image:
      url(../../../../misc/icons/333333/caret-down.svg),
      -webkit-linear-gradient(top, #fcfcfa, #e9e9dd);
  }
  select:hover {
    box-shadow: 0 1px 2px hsla(0, 0%, 0%, 0.125);
  }
}

/**
 * Improve spacing of cancel link.
 */
#edit-cancel {
  margin-left: 10px; /* LTR */
}
[dir="rtl"] #edit-cancel {
  margin-right: 10px;
  margin-left: 0;
}

/**
 * Improve form element usability on narrow devices.
 */
@media screen and (max-width: 600px) {
  input.form-autocomplete,
  input.form-text,
  input.form-tel,
  input.form-email,
  input.form-url,
  input.form-search,
  input.form-number,
  input.form-color,
  input.form-file,
  textarea.form-textarea {
    width: 100%;
    font-size: 1.2em;
    line-height: 1.2em;
  }
  input.form-number {
    width: auto;
  }
  .form-actions input,
  .form-wrapper input[type="submit"] {
    float: none;
    width: 100%;
    margin-top: 10px;
    margin-right: 0;
    margin-left: 0;
    padding-bottom: 6px;
  }
  .form-actions input:first-child,
  .form-wrapper input[type="submit"]:first-child {
    margin-top: 0;
  }
  details summary {
    overflow: hidden;
    box-sizing: border-box;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .password-strength {
    width: 100%;
  }
  div.form-item div.password-suggestions {
    float: none;
  }
  #dblog-filter-form .form-actions {
    float: none;
    padding: 0;
  }
  #edit-cancel {
    display: block;
    margin: 10px 0 0 0;
  }
  select {
    width: 100%;
  }
}

/* Exceptions */
#diff-inline-form select,
div.filter-options select {
  padding: 0;
}

/**
 * Prevent regression due to -webkit-appearance being set to button in
 * normalize.css 4.1.0.
 */
::-webkit-file-upload-button {
  -webkit-appearance: push-button;
}

File

core/themes/seven/css/components/form.css

View source
  1. /**
  2. * Form elements.
  3. */
  4. form {
  5. margin: 0;
  6. padding: 0;
  7. }
  8. /**
  9. * Prevent regression due to explicit line-height and font-size applied to these
  10. * elements in normalize.css 7.0.0.
  11. */
  12. button:not(.button),
  13. input:not([type="file"]):not(.form-text):not(.form-textarea) {
  14. line-height: 1.25em;
  15. }
  16. textarea,
  17. input[type="search"],
  18. input[type="number"],
  19. input[type="email"] {
  20. line-height: normal;
  21. }
  22. select {
  23. font-size: 0.8125rem;
  24. line-height: 1.42902em;
  25. }
  26. details select {
  27. line-height: 1.20324em;
  28. }
  29. /**
  30. * Prevent regression due to fieldset styling that was removed in normalize.css
  31. * 6.0.0.
  32. */
  33. fieldset {
  34. margin: 0 2px;
  35. padding: 0.35em 0.625em 0.75em;
  36. border: 1px solid #c0c0c0;
  37. }
  38. fieldset:not(.fieldgroup) {
  39. position: relative;
  40. min-width: 0;
  41. margin: 1em 0;
  42. padding: 30px 18px 18px;
  43. border-radius: 2px;
  44. background-color: #fcfcfa;
  45. }
  46. fieldset:not(.fieldgroup) > legend {
  47. position: absolute;
  48. top: 10px;
  49. letter-spacing: 0.08em;
  50. text-transform: uppercase;
  51. font-size: 1em;
  52. font-weight: bold;
  53. }
  54. .fieldgroup {
  55. min-width: 0;
  56. }
  57. .form-item {
  58. margin: 0.75em 0;
  59. }
  60. /**
  61. * When a table row has a single form item, prevent it from adding unnecessary
  62. * extra spacing. If it has multiple form items, allow spacing between them,
  63. * overriding Classy.
  64. */
  65. tr.odd .form-item,
  66. tr.even .form-item {
  67. margin-top: 0.75em;
  68. margin-bottom: 0.75em;
  69. }
  70. td > .form-item:only-child {
  71. margin-top: 0;
  72. margin-bottom: 0;
  73. }
  74. .form-type-checkbox {
  75. padding: 0;
  76. }
  77. label {
  78. display: table;
  79. margin: 0 0 0.1em;
  80. padding: 0;
  81. font-weight: bold;
  82. }
  83. label.error {
  84. color: #a51b00;
  85. }
  86. label[for] {
  87. cursor: pointer;
  88. }
  89. .form-item label.option {
  90. text-transform: none;
  91. }
  92. .form-item label.option input {
  93. vertical-align: middle;
  94. }
  95. .form-disabled label {
  96. color: #686868;
  97. }
  98. .form-disabled input.form-date,
  99. .form-disabled input.form-text,
  100. .form-disabled input.form-tel,
  101. .form-disabled input.form-time,
  102. .form-disabled input.form-email,
  103. .form-disabled input.form-url,
  104. .form-disabled input.form-search,
  105. .form-disabled input.form-number,
  106. .form-disabled input.form-color,
  107. .form-disabled input.form-file,
  108. .form-disabled textarea.form-textarea,
  109. .form-disabled select.form-select {
  110. border-color: #d4d4d4;
  111. background-color: hsla(0, 0%, 0%, 0.08);
  112. box-shadow: none;
  113. }
  114. .form-item input.error,
  115. .form-item textarea.error,
  116. .form-item select.error {
  117. color: #a51b00;
  118. border-width: 1px;
  119. border-color: #e62600;
  120. background-color: hsla(15, 75%, 97%, 1);
  121. box-shadow: inset 0 5px 5px -5px #b8b8b8;
  122. }
  123. .form-item textarea.error + .cke {
  124. border-width: 1px;
  125. border-color: #e62600;
  126. }
  127. .form-item textarea.error + .ck-editor > .ck-editor__main {
  128. border: 1px solid #e62600;
  129. }
  130. .form-item input.error:focus,
  131. .form-item textarea.error:focus,
  132. .form-item select.error:focus {
  133. border-color: #e62600;
  134. outline: 0;
  135. background-color: #fcf4f2;
  136. box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 8px 1px #e62600;
  137. }
  138. .form-required:after {
  139. width: 7px;
  140. height: 7px;
  141. background-size: 7px 7px;
  142. }
  143. .form-item--error-message {
  144. margin-top: 0.15em;
  145. color: #e32700;
  146. }
  147. .fieldset-wrapper > .form-item--error-message {
  148. margin-top: 0;
  149. }
  150. .text-format-wrapper .form-item--error-message {
  151. margin: 0;
  152. padding: 0.25em 0.666em 0;
  153. border: solid #ccc;
  154. border-width: 0 1px;
  155. }
  156. /* Filter */
  157. ul.tips,
  158. div.description,
  159. .form-item .description {
  160. margin: 0.2em 0 0 0;
  161. color: #595959;
  162. font-size: 0.95em;
  163. }
  164. .form-item .description.error {
  165. margin-top: 0;
  166. color: #a51b00;
  167. }
  168. ul.tips li {
  169. margin: 0.25em 0 0.25em 1.5em; /* LTR */
  170. }
  171. [dir="rtl"] ul.tips li {
  172. margin: 0.25em 1.5em 0.25em 0;
  173. }
  174. .form-type-radio .description,
  175. .form-type-checkbox .description {
  176. margin-left: 1.5em; /* LTR */
  177. }
  178. [dir="rtl"] .form-type-radio .description,
  179. [dir="rtl"] .form-type-checkbox .description {
  180. margin-right: 1.5em;
  181. margin-left: 0;
  182. }
  183. .form-text,
  184. .form-textarea {
  185. border-radius: 2px;
  186. font-size: 1em;
  187. line-height: normal;
  188. }
  189. input.form-autocomplete,
  190. input.form-text,
  191. input.form-tel,
  192. input.form-email,
  193. input.form-url,
  194. input.form-search,
  195. input.form-number,
  196. input.form-color,
  197. input.form-file,
  198. input.form-date,
  199. input.form-time,
  200. textarea.form-textarea {
  201. box-sizing: border-box;
  202. max-width: 100%;
  203. padding: 0.3em 0.4em 0.3em 0.5em; /* LTR */
  204. -webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
  205. transition: border linear 0.2s, box-shadow linear 0.2s;
  206. color: #595959;
  207. border: 1px solid #b8b8b8;
  208. border-top-color: #999;
  209. border-radius: 2px;
  210. background: #fcfcfa;
  211. box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.125);
  212. font-size: 1em;
  213. }
  214. [dir="rtl"] textarea.form-textarea {
  215. padding: 0.3em 0.5em 0.3em 0.4em;
  216. }
  217. .form-text:focus,
  218. .form-tel:focus,
  219. .form-email:focus,
  220. .form-url:focus,
  221. .form-search:focus,
  222. .form-number:focus,
  223. .form-color:focus,
  224. .form-file:focus,
  225. .form-textarea:focus,
  226. .form-date:focus,
  227. .form-time:focus {
  228. border-color: #40b6ff;
  229. outline: 0;
  230. background-color: #fff;
  231. box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 0 8px #40b6ff;
  232. }
  233. .confirm-parent,
  234. .password-parent {
  235. overflow: visible;
  236. width: auto;
  237. }
  238. .form-item-options-group-info-identifier,
  239. .form-item-pass .description {
  240. clear: both;
  241. }
  242. /**
  243. * Limits extra long instances of select elements to the max width allowed
  244. * to avoid breaking layouts.
  245. */
  246. select {
  247. max-width: 100%;
  248. }
  249. /**
  250. * Select elements - Webkit only
  251. */
  252. @media screen and (-webkit-min-device-pixel-ratio: 0) {
  253. select {
  254. padding: 1px 1.571em 1px 0.5em; /* LTR */
  255. cursor: pointer;
  256. -webkit-transition: all 0.1s;
  257. transition: all 0.1s;
  258. border: 1px solid #a6a6a6;
  259. border-radius: 0.143em;
  260. background:
  261. url(../../../../misc/icons/333333/caret-down.svg) no-repeat 99% 63%,
  262. -webkit-linear-gradient(top, #f6f6f3, #e7e7df); /* LTR */
  263. text-shadow: 0 1px hsla(0, 0%, 100%, 0.6);
  264. font-size: 0.875rem;
  265. -webkit-appearance: none;
  266. -webkit-font-smoothing: antialiased;
  267. }
  268. [dir="rtl"] select {
  269. padding: 1px 0.714em 1px 1.571em;
  270. background-position: 1% 63%, 0 0;
  271. }
  272. select:focus,
  273. select:hover {
  274. color: #1a1a1a;
  275. background-image:
  276. url(../../../../misc/icons/333333/caret-down.svg),
  277. -webkit-linear-gradient(top, #fcfcfa, #e9e9dd);
  278. }
  279. select:hover {
  280. box-shadow: 0 1px 2px hsla(0, 0%, 0%, 0.125);
  281. }
  282. }
  283. /**
  284. * Improve spacing of cancel link.
  285. */
  286. #edit-cancel {
  287. margin-left: 10px; /* LTR */
  288. }
  289. [dir="rtl"] #edit-cancel {
  290. margin-right: 10px;
  291. margin-left: 0;
  292. }
  293. /**
  294. * Improve form element usability on narrow devices.
  295. */
  296. @media screen and (max-width: 600px) {
  297. input.form-autocomplete,
  298. input.form-text,
  299. input.form-tel,
  300. input.form-email,
  301. input.form-url,
  302. input.form-search,
  303. input.form-number,
  304. input.form-color,
  305. input.form-file,
  306. textarea.form-textarea {
  307. width: 100%;
  308. font-size: 1.2em;
  309. line-height: 1.2em;
  310. }
  311. input.form-number {
  312. width: auto;
  313. }
  314. .form-actions input,
  315. .form-wrapper input[type="submit"] {
  316. float: none;
  317. width: 100%;
  318. margin-top: 10px;
  319. margin-right: 0;
  320. margin-left: 0;
  321. padding-bottom: 6px;
  322. }
  323. .form-actions input:first-child,
  324. .form-wrapper input[type="submit"]:first-child {
  325. margin-top: 0;
  326. }
  327. details summary {
  328. overflow: hidden;
  329. box-sizing: border-box;
  330. white-space: nowrap;
  331. text-overflow: ellipsis;
  332. }
  333. .password-strength {
  334. width: 100%;
  335. }
  336. div.form-item div.password-suggestions {
  337. float: none;
  338. }
  339. #dblog-filter-form .form-actions {
  340. float: none;
  341. padding: 0;
  342. }
  343. #edit-cancel {
  344. display: block;
  345. margin: 10px 0 0 0;
  346. }
  347. select {
  348. width: 100%;
  349. }
  350. }
  351. /* Exceptions */
  352. #diff-inline-form select,
  353. div.filter-options select {
  354. padding: 0;
  355. }
  356. /**
  357. * Prevent regression due to -webkit-appearance being set to button in
  358. * normalize.css 4.1.0.
  359. */
  360. ::-webkit-file-upload-button {
  361. -webkit-appearance: push-button;
  362. }

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