header-search-narrow.pcss.css

Same filename in other branches
  1. 10 core/themes/olivero/css/components/header-search-narrow.pcss.css
  2. 11.x core/themes/olivero/css/components/header-search-narrow.pcss.css

Header Search Narrow Block.

File

core/themes/olivero/css/components/header-search-narrow.pcss.css

View source
  1. /**
  2. * @file
  3. * Header Search Narrow Block.
  4. */
  5. @import "../base/variables.pcss.css";
  6. .block-search-narrow {
  7. margin-inline: calc(-1 * var(--sp));
  8. margin-block-end: var(--sp2);
  9. background: var(--color--black);
  10. & .search-block-form {
  11. display: flex;
  12. }
  13. & .form-item {
  14. flex-grow: 1;
  15. margin: 0;
  16. }
  17. & .form-actions {
  18. margin: 0;
  19. }
  20. & input[type="search"] {
  21. width: calc(100% + var(--sp2));
  22. height: calc(3 * var(--sp));
  23. padding-block: 0;
  24. padding-inline-start: var(--sp);
  25. padding-inline-end: var(--sp);
  26. transition: background-size 0.4s;
  27. color: var(--color--white);
  28. border: solid 1px transparent;
  29. background-color: transparent;
  30. background-image: linear-gradient(var(--color--blue-50), var(--color--blue-50)); /* Two values are needed for IE11 support. */
  31. background-repeat: no-repeat;
  32. background-position: bottom left; /* LTR */
  33. background-size: 0% 5px;
  34. box-shadow: none;
  35. font-family: var(--font-serif);
  36. font-size: 16px;
  37. -webkit-appearance: none;
  38. &::-ms-clear {
  39. width: 40px;
  40. opacity: 0.5;
  41. }
  42. &:focus {
  43. outline: solid 4px transparent;
  44. outline-offset: -4px;
  45. background-size: 100% 5px;
  46. /*
  47. We normally indicate focus by animating background-image width. This isn't
  48. available in IE11 when in Windows high contrast mode.
  49. */
  50. @media screen and (-ms-high-contrast: active) {
  51. border-bottom-width: 5px;
  52. }
  53. }
  54. @media (--md) {
  55. height: calc(4 * var(--sp));
  56. padding-inline-start: var(--sp2);
  57. padding-inline-end: var(--sp2);
  58. }
  59. }
  60. & .search-form__submit {
  61. position: relative;
  62. overflow: hidden;
  63. align-self: stretch;
  64. width: var(--sp3);
  65. height: auto;
  66. margin-block: 0;
  67. margin-inline-start: 0;
  68. margin-inline-end: 0;
  69. padding-block: 0;
  70. padding-inline-start: 0;
  71. padding-inline-end: 0;
  72. cursor: pointer;
  73. border-color: transparent;
  74. background-color: transparent;
  75. /*
  76. When in Windows high contrast mode, FF will not output either background
  77. images or SVGs that are nested directly within a element, so we add a .
  78. */
  79. & .icon--search {
  80. position: absolute;
  81. inset-block-start: 0;
  82. inset-inline-start: 0;
  83. display: block;
  84. width: 100%; /* Width of the SVG background image. */
  85. height: 100%;
  86. pointer-events: none;
  87. background-image: url("../../images/search--white.svg");
  88. background-repeat: no-repeat;
  89. background-position: center;
  90. background-size: auto;
  91. &:after {
  92. position: absolute;
  93. inset-block-end: 0;
  94. inset-inline-start: 0;
  95. width: 100%;
  96. height: 0;
  97. content: "";
  98. transition: transform 0.2s;
  99. transform: scaleX(0);
  100. transform-origin: left; /* LTR */
  101. border-block-start: solid 5px var(--color--blue-50);
  102. }
  103. @media (forced-colors: active) {
  104. background: buttontext;
  105. mask-image: url("../../images/search--white.svg");
  106. mask-repeat: no-repeat;
  107. mask-position: center;
  108. }
  109. }
  110. &:focus {
  111. outline: solid 4px transparent;
  112. outline-offset: -4px;
  113. box-shadow: none;
  114. & span:after {
  115. transform: scaleX(1);
  116. }
  117. @media screen and (-ms-high-contrast: active) {
  118. border-bottom-width: var(--sp0-5);
  119. & span:after {
  120. content: none;
  121. }
  122. }
  123. }
  124. @media (--md) {
  125. width: 80px;
  126. }
  127. @media screen and (-ms-high-contrast: active) {
  128. /* IE11's high contrast show will not show the background image, so we show the text. */
  129. & .visually-hidden {
  130. position: static;
  131. overflow: visible;
  132. clip: auto;
  133. width: auto;
  134. height: auto;
  135. text-align: center;
  136. }
  137. /* Edge's high contrast does show the background image, so we hide it. */
  138. & .icon--search {
  139. display: none;
  140. }
  141. }
  142. }
  143. /* 500px is the width of the primary nav at mobile. */
  144. @media (min-width: 500px) {
  145. margin-inline-start: 0;
  146. margin-inline-end: 0;
  147. }
  148. }
  149. body:not(.is-always-mobile-nav) .block-search-narrow {
  150. @media (--nav) {
  151. display: none;
  152. }
  153. }
  154. [dir="rtl"] .block-search-narrow {
  155. & input[type="search"] {
  156. background-position: bottom right;
  157. }
  158. & .search-form__submit .icon--search:after {
  159. transform-origin: right;
  160. }
  161. }

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