Skip to content

How to Create a Shrinking Header on Scroll in WordPress?

Key Takeaways

  • Nexter Blocks Pro only: el efecto de encabezado que se encoge requiere la función sticky y la opción shrink on scroll up en un bloque Container.
  • Padding controla el cambio: el encabezado usa padding normal grande al inicio y sticky padding más pequeño cuando queda fijo, sin un control separado de shrink.
  • El estado fijo añade fondo y sombra para separar el encabezado del contenido, y la transición se aplica al contenedor para que el cambio sea animado.
  • Las limitaciones incluyen un logo grande, enlaces ancla que pueden quedar debajo del encabezado fijo y un uso en móvil que rara vez compensa.
Table of Contents

A generous header looks right when someone arrives and wastes space for the rest of the visit. A header that disappears entirely takes the navigation with it.

A shrinking header does both jobs: full height at the top of the page, a compact bar once the visitor starts reading.

Before You Start

  • Edition: Pro — sticky containers and the shrink effect needs Nexter Blocks Pro.
  • Block to enable: Container, switched on under Nexter > Blocks in your WordPress dashboard.
  • A header built from a Container block — see the Container block guide and the sticky container guide.

Video Tutorial

Steps

  1. Set the full height of the header container, using padding rather than a fixed height so the content sets the size.
  1. Switch sticky on for the container.
  1. Switch on the shrink on scroll up behaviour.
  1. Set the sticky padding — the smaller padding the header takes once it is stuck. This is what produces the shrink.
  1. Give the stuck state a background and a shadow so it separates from the content behind it.
  1. Publish and scroll the real page.

How It Behaves

There is no separate shrink control. The header shrinks because the stuck state has smaller padding than the normal state.

  • Measured on a published page: a container with sticky and the scroll-up option set rendered tpgb-sticky-enable, with the sticky padding stored alongside it.
  • Padding is the mechanism. Set the normal padding generously and the sticky padding tightly — the difference between the two is the amount of shrink.
  • Use padding, not a fixed height. A fixed height fights the logo and the menu at small widths; padding lets the content decide.
  • The transition is applied to the container, so the change is animated rather than a jump.
  • Measured with Nexter Blocks Pro deactivated: this effect disappears completely and the container renders as a plain section, with nothing on the page to say why.

Limitations

  • Pro only — measured with Nexter Blocks Pro deactivated, the sticky class is absent entirely and the header simply scrolls away.
  • A big logo limits how far it can shrink. The header cannot become shorter than what is inside it, so give the logo a smaller size in the stuck state too.
  • Anchor links can land under the header. The browser scrolls the target to the very top of the window, which is where the stuck header sits — relevant if you use anchor links.
  • Shrinking on a phone is rarely worth it. A mobile header is already compact; the movement is more distracting than useful.

Troubleshooting

The header does not shrink

The sticky padding is probably the same as the normal padding, so there is nothing to shrink by. Set the sticky padding smaller.

The header does not stick at all

Check Nexter Blocks Pro is active, and see the sticky container guide — a parent with its own overflow rule is the usual cause.

The content jumps when it sticks

That is the page reflowing as the header leaves the flow. Give the section below a little top spacing so the change is less abrupt.

My anchor links land in the wrong place

The stuck header is covering the target. Add top padding to the linked sections to compensate.

The logo looks squashed once stuck

Set a smaller logo size for the stuck state as well, rather than relying on the container padding alone.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!

Related Frequently Asked Questions

What do I need before creating a shrinking header on scroll in WordPress?

Nexter Blocks Pro is the key requirement, because the sticky container and shrink effect depend on it. The header also needs to be built from a Container block, with sticky containers enabled under Nexter in the WordPress dashboard. That matters because the shrink effect is driven by padding changes on the container, not by a separate shrink setting or a fixed-height header.

Why does my shrinking header not shrink when I scroll?

The usual cause is that the sticky padding matches the normal padding, so there is no visual difference for the header to shrink into. Nexter Blocks Pro creates the effect by making the stuck state tighter than the default state. A practical fix is to keep the normal padding generous and reduce only the sticky padding, since that difference is what produces the shrink.

What is the best way to make a shrinking header look smooth instead of jumpy?

Padding is the better choice here, not a fixed height. The page says fixed height fights the logo and menu at small widths, while padding lets the content define the size. Nexter Blocks Pro applies the transition to the container, so the change animates rather than snapping. That gives you a cleaner scroll experience and avoids layout fights inside the header.

Why does my header stop sticking when I enable shrink on scroll?

A parent with its own overflow rule is usually what breaks sticky behavior. The page also says to confirm Nexter Blocks Pro is active, because without it the sticky class is absent and the header just scrolls away. In practice, this means sticky problems are often caused by layout context above the header, not by the header itself.

Can I use a shrinking header with anchor links in WordPress?

Anchor links can work, but they may land under the stuck header because browsers scroll targets to the top of the window. That becomes visible once the header is sticky and compact. The practical fix is extra top padding on linked sections so the target sits below the header instead of being covered by it. See anchor links.

Should I use a shrinking header on mobile?

Shrinking headers are rarely worth it on phones because mobile headers are already compact and extra motion can feel more distracting than useful. The page also notes that a big logo limits how far any header can shrink, so mobile layouts hit that limit even faster. For smaller screens, keeping spacing simple usually works better than trying to force a dramatic shrink.

Last reviewed: September 28, 2026

Related Docs