site-header.pcss.css

Same filename in other branches
  1. 10 core/themes/olivero/css/components/site-header.pcss.css
  2. 11.x 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/variables.pcss.css";
  6. .site-header {
  7. position: relative;
  8. /**
  9. * Ensure mobile site header is always above other elements including
  10. * contextual links, quick-edit, and Tour.
  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--blue-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(-1 * var(--sp4));
  45. max-width: var(--max-bg-color);
  46. }
  47. /* Toolbar is fixed, and tray is either vertical or closed and horizontal. */
  48. &.toolbar-vertical.toolbar-fixed,
  49. &.toolbar-horizontal.toolbar-fixed {
  50. & .site-header__fixable.is-fixed {
  51. inset-block-start: calc(var(--toolbar-height) - var(--sp4));
  52. }
  53. }
  54. /* Toolbar is fixed, and tray is open and horizontal. */
  55. &.toolbar-horizontal.toolbar-fixed.toolbar-tray-open .site-header__fixable.is-fixed {
  56. inset-block-start: calc(var(--toolbar-tray-height) + var(--toolbar-height) - var(--sp4));
  57. }
  58. }
  59. }
  60. .site-header__inner {
  61. z-index: 1; /* Appear in front of Drupal's tabs. */
  62. flex-grow: 1;
  63. width: calc(100vw - var(--content-left));
  64. background: var(--color--white);
  65. }
  66. /*
  67. * Only apply transition styles when JS is loaded. This
  68. * works around https://bugs.chromium.org/p/chromium/issues/detail?id=332189
  69. */
  70. html.js body:not(.is-always-mobile-nav) .site-header__inner {
  71. @media (--nav) {
  72. transition: opacity 0.3s, transform 0.3s, box-shadow 0.3s;
  73. }
  74. }
  75. .site-header__fixable.is-expanded .site-header__inner {
  76. @media (--nav) {
  77. box-shadow: -36px 1px 36px rgba(0, 0, 0, 0.08); /* LTR */
  78. }
  79. }
  80. [dir="rtl"] .site-header__fixable.is-expanded .site-header__inner {
  81. @media (--nav) {
  82. box-shadow: 36px 1px 36px rgba(0, 0, 0, 0.08);
  83. }
  84. }
  85. /* Hide the desktop nav when it's fixed and not active. */
  86. body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed:not(.is-expanded) .site-header__inner {
  87. @media (--nav) {
  88. transform: translateX(-101%); /* LTR */
  89. opacity: 0;
  90. }
  91. }
  92. [dir="rtl"] body:not(.is-always-mobile-nav) .site-header__fixable.is-fixed:not(.is-expanded) .site-header__inner {
  93. @media (--nav) {
  94. transform: translateX(101%);
  95. }
  96. }
  97. .site-header__inner__container {
  98. display: flex;
  99. justify-content: space-between;
  100. }

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