form--text.pcss.css

Same filename in other branches
  1. 9 core/themes/claro/css/components/form--text.pcss.css
  2. 10 core/themes/claro/css/components/form--text.pcss.css
  3. 11.x core/themes/claro/css/components/form--text.pcss.css

Text and textarea input elements.

File

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

View source
  1. /**
  2. * @file
  3. * Text and textarea input elements.
  4. */
  5. @import "../base/variables.pcss.css";
  6. .form-element {
  7. box-sizing: border-box;
  8. max-width: 100%;
  9. min-height: calc(((var(--input-padding-vertical) + var(--input-border-size)) * 2) + var(--input-line-height)); /* iOS. */
  10. padding: var(--input-padding-vertical) var(--input-padding-horizontal);
  11. color: var(--input-fg-color);
  12. border: var(--input-border-size) solid var(--input-border-color);
  13. border-radius: var(--input-border-radius-size);
  14. background: var(--input-bg-color);
  15. font-size: var(--input-font-size);
  16. line-height: var(--input-line-height);
  17. appearance: none; /* Being able to control inner box shadow on iOS. */
  18. }
  19. .no-touchevents .form-element--extrasmall,
  20. .no-touchevents .form-element[name$="][_weight]"] {
  21. min-height: calc(((var(--input--extrasmall-padding-vertical) + var(--input-border-size)) * 2) + var(--input--extrasmall-line-height)); /* iOS. */
  22. padding: var(--input--extrasmall-padding-vertical) var(--input--extrasmall-padding-horizontal);
  23. font-size: var(--input--extrasmall-font-size);
  24. line-height: var(--input--extrasmall-line-height);
  25. }
  26. /**
  27. * Override normalize.css's search appearance.
  28. */
  29. .form-element--type-search[type="search"] {
  30. appearance: none;
  31. box-sizing: border-box;
  32. }
  33. /**
  34. * Fix minor things for specific types.
  35. */
  36. .form-element--type-date,
  37. .form-element--type-time {
  38. vertical-align: -webkit-baseline-middle; /* Prevent iOS input jump while filling. */
  39. }
  40. .form-element--type-date {
  41. min-width: 9.5rem; /* Prevent input width change while filling. */
  42. }
  43. .form-element--type-time {
  44. min-width: 7.5rem; /* Prevent input width change while filling. */
  45. }
  46. .form-element--type-color {
  47. min-width: 3rem; /* Bigger input for webkit */
  48. padding: 0; /* Bigger pickable area */
  49. text-indent: calc(0.75rem - var(--input-border-size)); /* Text-input fallback for non-supporting browsers like Safari */
  50. }
  51. /**
  52. * Reset value border and background of the file input on IE11 and Edge.
  53. */
  54. .form-element--type-file::-ms-value {
  55. border: 0;
  56. background: inherit;
  57. }
  58. /**
  59. * Better upload button alignment for Chrome.
  60. */
  61. .form-element--type-file::-webkit-file-upload-button {
  62. vertical-align: top;
  63. }
  64. /**
  65. * Target IE 11 and Edge.
  66. *
  67. * Reduce the vertical padding of the file input element to make the browse
  68. * button fit into the needed input height.
  69. */
  70. /* stylelint-disable-next-line selector-type-no-unknown */
  71. _:-ms-fullscreen,
  72. :root .form-element--type-file {
  73. padding-top: 0.25rem;
  74. padding-bottom: 0.25rem;
  75. }
  76. /**
  77. * States.
  78. */
  79. .form-element:active {
  80. border-color: var(--input--focus-border-color);
  81. }
  82. .form-element:hover {
  83. border-color: var(--input--hover-border-color);
  84. box-shadow: inset 0 0 0 var(--input-border-size) var(--input--hover-border-color);
  85. }
  86. .form-element:focus {
  87. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus);
  88. }
  89. .form-element:hover:focus {
  90. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus), inset 0 0 0 var(--input-border-size) var(--input--hover-border-color);
  91. }
  92. .form-element.error {
  93. border-width: var(--input--error-border-size);
  94. border-color: var(--input--error-border-color);
  95. }
  96. .form-element.error:hover {
  97. box-shadow: none;
  98. }
  99. .form-element.error:hover:focus {
  100. box-shadow: 0 0 0 2px var(--color-white), 0 0 0 5px var(--color-focus);
  101. }
  102. .form-element--type-textarea.error + .cke {
  103. border-color: var(--input--error-border-color);
  104. }
  105. .form-element[disabled] {
  106. color: var(--input--disabled-fg-color);
  107. border-color: var(--input--disabled-border-color);
  108. background-color: var(--input--disabled-bg-color);
  109. box-shadow: none;
  110. /* https://stackoverflow.com/q/262158#answer-23511280 */
  111. -webkit-text-fill-color: var(--input--disabled-fg-color);
  112. }
  113. /**
  114. * Improve form element usability on narrow devices.
  115. */
  116. @media screen and (max-width: 600px) {
  117. /* Number, date and time are skipped here */
  118. .form-element {
  119. float: none;
  120. width: 100%;
  121. margin-top: 0.75rem;
  122. margin-right: 0;
  123. margin-left: 0;
  124. }
  125. .form-element:first-child,
  126. .form-item__label + .form-element {
  127. margin-top: 0;
  128. }
  129. }

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