Search

Nalezeno "sticky": 19

How to Make a “Raise the Curtains” Effect in CSS


“Raise the curtains” is what I call an effect where the background goes from dark to light on scroll, and the content on top also goes from light to dark while in a sticky position. Here’s an example where I … How to Make a “Raise the Curtains” Effect in CSS originally published...

Using Position Sticky With CSS Grid


Say you’ve got a two-column CSS grid and you want one of those columns to behave like position: sticky;. There is nothing stopping you from doing that. But the default height for those two columns is going to be …

A Clever Sticky Footer Technique


Upon hearing “sticky footer” these days, I would think most people imagine a position: sticky situation where a footer element appears fixed on the screen while in the scrolling context of some parent element. That’s not quite what I’m talking … The post A Clever...

Sticky Headers: 5 Ways to Make Them Better


Page Laubheimer says that if you’re going to do a sticky header… Keep it small. Visually contrast it with the rest of the page. If it’s going to move, keep it minimal. (I’d say, respect prefers-reduced-motion.) Consider “partially persistent … The post Sticky...

Creating a Smart Navbar With Vanilla JavaScript


Sticky, or fixed, navigation is a popular design choice because it gives users persistent access to navigate the site. On the other hand, it takes up space on the page and sometimes covers content is a way that’s less than … The post Creating a Smart Navbar With Vanilla JavaScript appeared...

How to Create a Shrinking Header on Scroll Without JavaScript


Imagine a header of a website that is nice and thick, with plenty of padding on top and bottom of the content. As you scroll down, it shrinks up on itself, reducing some of that padding, making more screen real … The post How to Create a Shrinking Header on Scroll Without JavaScript appeared...

A table with both a sticky header and a sticky first column


We’ve covered that individual <table> cells, <th> and <td> can be position: sticky. It’s pretty easy to make the header of a table stick to the top of the screen while scrolling through a bunch or rows (like this … The post A table with both a sticky...

How to Get Sticky and Full-Bleed Elements to Play Well Together


I had a unique requirement the other day: to build a layout with full-bleed elements while one element stays stuck to the top. This ended up being rather tricky to pull off so I’m documenting it here in case anyone needs to re-create this same effect. Part of the trickiness was dealing with logical...

A Dynamically-Sized Sticky Sidebar with HTML and CSS


Creating page content that sticks to the viewport as you scroll, something like a jump-to-anchor menu or section headings, has never been easier. Throw a position: sticky into your CSS ruleset, set the directional offset (e.g. top: 0) and you’re ready to impress your teammates with minimal effort....

How to Use CSS Grid for Sticky Headers and Footers


CSS Grid is a collection of properties designed to make layout easier than it’s ever been. Like anything, there’s a bit of a learning curve, but Grid is honestly fun to work with once you get the hang of it. One area where it shines is dealing with headers and footers. With a little...

Stacked Cards with Sticky Positioning and a Dash of Sass


The other day, I spotted this particularly lovely bit from Corey Ginnivan’s website where a collection of cards stack on top of one another as you scroll. I started wondering how much JavaScript this would involve and how you’d go about making it when I realized — ah! — this must be the work...

A “new direction” in the struggle against rightward scrolling


You know those times you get a horizontal scrollbar when accidentally placing an element off the right edge of the browser window? It might be a menu that slides in or the like. Sometimes we to overflow-x: hidden; on the body to fix that, but that can sometimes wreck stuff like position:...

Indicating Scroll Position on a Page With CSS


Scrolling is something we all know and do on the web to the extent that it’s an expectation or perhaps even a habit, like brushing our teeth. That’s probably why we don’t put too much thought into designing the scrolling experience — it’s a well-known basic function. In fact, the popular “there...

Getting Fancy with position: sticky;


Mike Solomon worked on a fancy scrollytelling post for Esquire and blogged about it. It has GIFs of each step along the way of figuring out not just position: sticky; but also using negative margins, wrapper divs, backgrounds, and even a smidge of JavaScript measuring to get it all right. What...

Position Sticky and Table Headers


You can't position: sticky; a <thead>. Nor a <tr>. But you can sticky a <th>, which means you can make sticky headers inside a regular ol' <table>. This is tricky stuff, because if you didn't know this weird quirk, it would be hard to blame you. It makes way more...

How to Create a Sticky Image Effect with Three.js


A recreation of the sticky image effect seen on the websites of MakeReign and Ultranoir using three.js. How to Create a Sticky Image Effect with Three.js was written by Daniel Velasquez and published on Codrops

Dealing with overflow and position: sticky;


Any overflow value other than visible and no height is the enemy of child elements with position: sticky;. It's like that element is ready to stick when the parent scrolls, but it never does because the height is unconstrained. Adding a fixed height can solve the issue, but that's not always...

More Like position: tricky;


I rather like position: sticky;. It has practical use cases. I think of things like keeping a table of contents in a sidebar of a long article, but as a fairly simple implementation and without risk of overlapping things in awkward ways. But Elad Shechter is right here: it's not used that much...

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace