header-search-narrow.pcss.css

Same filename in other branches
  1. 9 core/themes/olivero/css/components/header-search-narrow.pcss.css
  2. 10 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/media-queries.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: var(--sp3);
  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--primary-50), var(--color--primary-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. &:focus {
  39. outline: solid 4px transparent;
  40. outline-offset: -4px;
  41. background-size: 100% 5px;
  42. }
  43. @media (--md) {
  44. height: var(--sp4);
  45. padding-inline-start: var(--sp2);
  46. padding-inline-end: var(--sp2);
  47. }
  48. }
  49. & .search-form__submit {
  50. position: relative;
  51. overflow: hidden;
  52. align-self: stretch;
  53. width: var(--sp3);
  54. height: auto;
  55. margin-block: 0;
  56. margin-inline-start: 0;
  57. margin-inline-end: 0;
  58. padding-block: 0;
  59. padding-inline-start: 0;
  60. padding-inline-end: 0;
  61. cursor: pointer;
  62. border-color: transparent;
  63. background-color: transparent;
  64. /*
  65. When in Windows high contrast mode, FF will not output either background
  66. images or SVGs that are nested directly within a element, so we add a .
  67. */
  68. & .icon--search {
  69. position: absolute;
  70. inset-block-start: 0;
  71. inset-inline-start: 0;
  72. display: block;
  73. width: 100%; /* Width of the SVG background image. */
  74. height: 100%;
  75. pointer-events: none;
  76. background-image: url("../../images/search--white.svg");
  77. background-repeat: no-repeat;
  78. background-position: center;
  79. background-size: auto;
  80. &::after {
  81. position: absolute;
  82. inset-block-end: 0;
  83. inset-inline-start: 0;
  84. width: 100%;
  85. height: 0;
  86. content: "";
  87. transition: transform 0.2s;
  88. transform: scaleX(0);
  89. transform-origin: left; /* LTR */
  90. border-block-start: solid 5px var(--color--primary-50);
  91. }
  92. @media (forced-colors: active) {
  93. background: buttontext;
  94. mask-image: url("../../images/search--white.svg");
  95. mask-repeat: no-repeat;
  96. mask-position: center;
  97. }
  98. }
  99. &:focus {
  100. outline: solid 4px transparent;
  101. outline-offset: -4px;
  102. box-shadow: none;
  103. & span::after {
  104. transform: scaleX(1);
  105. }
  106. @media screen and (-ms-high-contrast: active) {
  107. border-bottom-width: var(--sp0-5);
  108. & span::after {
  109. content: none;
  110. }
  111. }
  112. }
  113. @media (--md) {
  114. width: 80px;
  115. }
  116. @media screen and (-ms-high-contrast: active) {
  117. /* IE11's high contrast show will not show the background image, so we show the text. */
  118. & .visually-hidden {
  119. position: static;
  120. overflow: visible;
  121. clip: auto;
  122. width: auto;
  123. height: auto;
  124. text-align: center;
  125. }
  126. /* Edge's high contrast does show the background image, so we hide it. */
  127. & .icon--search {
  128. display: none;
  129. }
  130. }
  131. }
  132. /* 500px is the width of the primary nav at mobile. */
  133. @media (min-width: 500px) {
  134. margin-inline-start: 0;
  135. margin-inline-end: 0;
  136. }
  137. }
  138. body:not(.is-always-mobile-nav) .block-search-narrow {
  139. @media (--nav) {
  140. display: none;
  141. }
  142. }
  143. [dir="rtl"] .block-search-narrow {
  144. & input[type="search"] {
  145. background-position: bottom right;
  146. }
  147. & .search-form__submit .icon--search::after {
  148. transform-origin: right;
  149. }
  150. }

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