← All posts

Tutorials

Tame the sticky elements that cover your content

A sticky header that stays 90 px tall while you scroll. A floating "subscribe to the newsletter" bar. A "back to top" button covering the last sentence of a paragraph. Elements glued to the screen can eat a third of the view. Here is how to tame them.

What glues them

Two CSS properties: position: sticky (the element sticks once you scroll to its place) and position: fixed (the element sits in place from the start). Both can be overridden.

Two approaches

Unstick — the element stays, but scrolls with the page. Good for headers that are useful, just do not need to be on top forever.

header, .site-header, .navbar,
[class*="sticky"], [class*="fixed"] {
  position: static !important;
}

Hide — the element disappears entirely. Good for floating CTAs, "back to top" widgets, promo bars.

[class*="back-to-top"], [class*="scroll-top"],
[class*="sticky-cta"], [class*="floating-bar"] {
  display: none !important;
}

How to find the culprit

Not sure which element is glued? Open the JustZix JS Console and type:

[...document.querySelectorAll('*')]
  .filter(el => {
    const p = getComputedStyle(el).position;
    return p === 'fixed' || p === 'sticky';
  })
  .forEach(el => console.log(el));

The console lists every fixed and sticky element — hover each to see it on the page, then copy its class into the rule selector.

Pitfalls

See also

Install JustZix — and reclaim the screen taken by glued-on bars.

Rate this post

No ratings yet — be the first.

Try it yourself

Install JustZix and paste any snippet from this article. Two minutes from zero to a working rule across all your devices.

Get JustZix

Features · How it works · Examples · Use cases