Categories: css-tricks.com

Sticky Headers And Full-Height Elements: A Tricky Combination

Quite a fun article I worked on with Philip Braunen. Do you know that little bit of elasticity you get when scrolling beyond the viewport when browsing the web on a mobile device? iPhone calls it a “rubber-banding” effect. And you know it’s cool because Apple has previously fought to hold a copyright on it.

Anyway, Philip wrote into Smashing Magazine with a clever approach to mimic rubber-banding in CSS — not only for non-mobile UI but also applied to any sort of container you like.

But what about sticky headers and footers? If those have to be pinned to the container’s block edges, then how in heck do we include them in the rubber banding? Phillip’s trick is an extra div before the header, though we can get more concise markup using pseudos instead.


Sticky Headers And Full-Height Elements: A Tricky Combination originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

hnikoloski

Share
Published by
hnikoloski

Recent Posts

Quick Hit #20

Having fun with Bramus’ new Caniuse CLI tool. This’ll save lots of trips to the…

10 hours ago

Quick Hit #19

Two possible syntaxes for CSS masonry, one draft specification, and you get to share your…

12 hours ago

Re-Working the CSS Almanac

Getting right to it: the CSS-Tricks Almanac got a big refresh this week! I’m guessing…

13 hours ago

Clever Polypane Debugging Features I’m Loving

I’m working on a refresh of my personal website, what I’m calling the HD remaster.…

3 days ago

Multiple Anchors

Only Chris, right? You’ll want to view this in a Chromium browser: CodePen Embed Fallback…

3 days ago

Smashing Hour With Lynn Fisher

I’m a big Lynn Fisher fan. You probably are, too, if you’re reading this. Or…

3 days ago