Phil Perkins Photography

WordPress Offers “Sticky” Option

A new feature at WordPress for users with FSE (Full Site Editing) themes now provides for an assignment of blocks as having a “sticky” (fixed) position. I learned about this while reading an article at WP Tavern and have since applied it to my primary navigation, which now remains in place at the top of my web site.

To do so, I defined the Navigation block as a Group block and set its position to “Sticky”. In the templates, I also made it a top-level element. Because I use a Cover block in my header, it was also necessary to add the following CSS (Appearance > Additional CSS) to keep the menu and header image plum…

header {
margin-block-start: 0 !important;
}

%d bloggers like this: