Skip to content

Commit

Permalink
add sticky header'
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmchiu committed Jun 15, 2024
1 parent 4682713 commit b6c1404
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions _sass/custom/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,54 @@ code span[style*="color: red"] {

code[style*="color: red"] {
color: var(--red-color) !important;
}

// Begin UCB header fixes

// If width of display is less than content-width, header is invisible
// so no extra CSS is needed

// If width of display is at least content width:
@media (min-width: $content-width) {
.main-header {
position: fixed; // Sticky header (stays on top as you scroll)
top: 0; // Forces header on top of page
z-index: 1000; // Forces header drawn on top of everything else
}

// Forces site title in sidebar to be flush with header
.side-bar {
top: 0;
left: 0;
}

// Add whitespace between header and start of content (site title, logo)
.main-content-wrap {
margin-top: 60px;
}

// Make the site title in the sidebar smaller
.site-title {
font-size: 19px !important;
}

// Header width should be all of display, minus sidebar
// Seems like JTD fixes sidebar to 15.5rem in this layout (might be wrong tho)
.main-header {
width: calc(100% - 15.5rem);
}
}

// If width of display is at least content+nav width
// (i.e. whitespace on either side of site):
@media (min-width: $content-width + $nav-width) {
// Set default site title in sidebar font size
.site-title {
font-size: 24px !important;
}

// Header should match content width (e.g. in wider.scss)
.main-header {
width: $content-width;
}
}

0 comments on commit b6c1404

Please sign in to comment.