How-to guide

A header that stays on top

One class on the top section keeps the logo and menu in view. This website uses exactly this.

Steps

  1. Select the header block. In the Section tab, type sticky-top in Section classes.

  2. Open System › Site CSS and paste the CSS below. Save.

  3. Log out (or use a private window) to see it: while you edit, the header stays in place so it doesn’t hide under the tools. On phones it scrolls away too, because a tall sticky header takes space.

CSS

.sticky-top { position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
/* Not on small screens, and not while you edit (the editor's tools sit at the top) */
@media (max-width: 640px) { .sticky-top { position: static; } }
.jc-editing .sticky-top { position: static; }

Prompt for your AI

In my JoodCMS kit, make the top region section of global.json sticky: add "className": "sticky-top" to that section
and add the sticky CSS (static on screens under 640px) to theme.json. Change nothing else and return the complete kit.

← All guides

made by Content Management System