site-header.pcss.css

Same filename in other branches
  1. 9 core/themes/olivero/css/components/site-header.pcss.css
  2. 10 core/themes/olivero/css/components/site-header.pcss.css

Site header.

File

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

View source
  1. /**
  2. * @file
  3. * Site header.
  4. */
  5. @import "../base/media-queries.pcss.css";
  6. .site-header {
  7. position: relative;
  8. /**
  9. * Ensure mobile site header is always above other elements including
  10. * contextual links.
  11. */
  12. z-index: 101;
  13. @media (--nav) {
  14. /* Necessary to keep the content from jumping up when header transitions to fixed. */
  15. min-height: var(--site-header-height-wide);
  16. border-block-end: solid 1px transparent; /* Will show in Windows high contrast mode. */
  17. }
  18. }
  19. .site-header__initial {
  20. position: relative;
  21. z-index: 102;
  22. display: flex;
  23. align-items: flex-end;
  24. align-self: stretch;
  25. background-color: var(--color--primary-50);
  26. }
  27. .site-header__fixable {
  28. display: flex;
  29. align-items: flex-end;
  30. transition: all 0.5s;
  31. &.is-fixed {
  32. @media (--nav) {
  33. &:not(.is-expanded) {
  34. pointer-events: none;
  35. }
  36. }
  37. }
  38. }
  39. @media (--nav) {
  40. body:not(.is-always-mobile-nav) {
  41. & .site-header__fixable.is-fixed {
  42. position: fixed;
  43. z-index: 102; /* Appear above body content that is position: relative */
  44. inset-block-start: calc(var(--drupal-displace-offset-top, 0px) - var(--sp4));
  45. max-width: var(--max-bg-color);
  46. }
  47. }
  48. }
  49. .site-header__inner {
  50. position: relative;
  51. z-index: 1; /* Appear in front of Drupal's tabs. */
  52. flex-grow: 1;
  53. width: calc(100vw - var(--content-left) - var(--drupal-displace-offset-left, 0px) - var(--drupal-displace-offset-right, 0px));
  54. background: var(--color--white);
  55. }
  56. /*
  57. * Only apply transition styles when JS is loaded. This
  58. * works around https://bugs.chromium.org/p/chromium/issues/detail?id=332189
  59. */
  60. html.js body:not(.is-always-mobile-nav) .site-header__inner {
  61. @media (--nav) {
  62. transition:
  63. opacity 0.3s,
  64. transform 0.3s,
  65. box-shadow 0.3s;
  66. }
  67. }
  68. .site-header__fixable.is-expanded .site-header__inner {
  69. @media (--nav) {
  70. box-shadow: -36px 1px 36px rgba(0, 0, 0, 0.08); /* LTR */
  71. }
  72. }
  73. [dir="rtl"] .site-header__fixable.is-expanded .site-header__inner {
  74. @media (--nav) {
  75. box-shadow: 36px 1px 36px rgba(0, 0, 0, 0.08);
  76. }
  77. }
  78. /* Hide the desktop nav when it's fixed and not active. */
  79. body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed:not(.is-expanded) .site-header__inner {
  80. @media (--nav) {
  81. transform: translateX(-101%); /* LTR */
  82. opacity: 0;
  83. }
  84. }
  85. [dir="rtl"] body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed:not(.is-expanded) .site-header__inner {
  86. @media (--nav) {
  87. transform: translateX(101%);
  88. }
  89. }
  90. .site-header__inner__container {
  91. display: flex;
  92. justify-content: space-between;
  93. }
  94. /* Reset width set by layout.css */
  95. body.is-fixed .site-header__inner__container {
  96. width: auto;
  97. }

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