header-navigation.pcss.css

Same filename in other branches
  1. 9 core/themes/olivero/css/components/header-navigation.pcss.css
  2. 11.x core/themes/olivero/css/components/header-navigation.pcss.css

Navigation in header.

File

core/themes/olivero/css/components/header-navigation.pcss.css

View source
  1. /**
  2. * @file
  3. * Navigation in header.
  4. */
  5. @import "../base/media-queries.pcss.css";
  6. .header-nav {
  7. position: fixed;
  8. z-index: 501; /* Appear above overlay and contextual links in header. */
  9. inset-block-start: 0;
  10. inset-inline-start: 100%;
  11. visibility: hidden;
  12. overflow: auto;
  13. /* Ensure that header nav not use additional space and force system branding
  14. * block text to unnecessarily wrap. */
  15. flex-basis: max-content;
  16. width: 100%;
  17. max-width: var(--mobile-nav-width);
  18. height: 100%;
  19. padding-block: 0 var(--sp);
  20. padding-inline-start: var(--sp);
  21. padding-inline-end: var(--sp);
  22. /* Create room for the "close" button. We cannot use margin because the
  23. * mobile navigation needs to slide beneath the button, but we also cannot
  24. * use padding because that would enable the button to scroll out of the
  25. * viewport on short screens. */
  26. border-block-start: solid var(--color--white) calc(var(--sp3) + var(--drupal-displace-offset-top, 0px));
  27. background-color: var(--color--white);
  28. box-shadow: 0 0 72px rgba(0, 0, 0, 0.1);
  29. &.is-active {
  30. visibility: visible;
  31. transform: translateX(calc(-100% - var(--drupal-displace-offset-right, 0px))); /* LTR */
  32. &:dir(rtl) {
  33. transform: translateX(calc(100% + var(--drupal-displace-offset-left, 0px)));
  34. }
  35. }
  36. @media (--sm) {
  37. border-top-width: calc(var(--sp5) + var(--drupal-displace-offset-top, 0px));
  38. }
  39. @media (--md) {
  40. padding-block-end: var(--sp3);
  41. padding-inline-start: var(--sp3);
  42. border-top-width: calc(var(--sp7) + var(--drupal-displace-offset-top, 0px));
  43. }
  44. @media (--lg) {
  45. grid-column: 5 / 14;
  46. }
  47. /*
  48. * Ensure top border has the same color as the background when in forced colors.
  49. */
  50. @media (forced-colors: active) {
  51. border-top-color: canvas;
  52. }
  53. }
  54. /*
  55. * Only apply transition styles when JS is loaded. This
  56. * works around https://bugs.chromium.org/p/chromium/issues/detail?id=332189
  57. */
  58. html.js .header-nav {
  59. transition:
  60. visibility 0.2s,
  61. transform 0.2s;
  62. }
  63. body:not(.is-always-mobile-nav) .header-nav {
  64. @media (--nav) {
  65. position: static;
  66. display: flex;
  67. visibility: visible;
  68. overflow: visible;
  69. grid-column: 5 / 15;
  70. align-items: center;
  71. justify-content: flex-end;
  72. max-width: none;
  73. height: var(--header-height-wide-when-fixed);
  74. margin-block-start: auto;
  75. padding-block: 0;
  76. padding-inline-start: 0;
  77. padding-inline-end: 0;
  78. transition: transform 0.2s;
  79. transform: none;
  80. border-block-start: 0;
  81. box-shadow: none;
  82. }
  83. }
  84. body.is-always-mobile-nav {
  85. & .header-nav {
  86. @media (--nav) {
  87. overflow: auto;
  88. max-width: calc((7 * (var(--grid-col-width) + var(--grid-gap))));
  89. padding-inline-end: var(--sp);
  90. transition:
  91. transform 0.2s,
  92. visibility 0.2s;
  93. border-top-width: calc(var(--drupal-displace-offset-top, 0px) + var(--sp11));
  94. }
  95. @media (--grid-max) {
  96. max-width: calc(100vw - (var(--max-width) + var(--content-left)) + ((7 * (var(--grid-col-width) + var(--grid-gap)))));
  97. padding-inline-end: calc(100vw - (var(--max-width) + var(--content-left) - var(--sp)));
  98. }
  99. }
  100. }
  101. .header-nav-overlay {
  102. position: fixed;
  103. z-index: 101;
  104. inset-block-start: 0;
  105. inset-inline-start: 0;
  106. display: none;
  107. width: 100%;
  108. height: 100vh;
  109. opacity: 0.2;
  110. background: var(--color--gray-5);
  111. @media (forced-colors: active) {
  112. background: canvastext;
  113. }
  114. @nest .is-overlay-active
  115. }

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