Position Sticky

Hello,
I have heard of the position atribute in CSS but I don’t know how to use it,
do you have some advice?

Thanks

If you are trying to use position relative/absolute to center things, my advice is not to. It is usually a lot more simpler to use flexbox for creating containers and centering.

1 Like

The article was very useful, but, I was trying to use position sticky.
Do you have advice for sticky position?
Thanks

So something with postion sticky will scroll with the page as normal then switch to being fixed in the position you have specified it should be when it hits the edge of the viewport. So starts basically as normal position: static then turns into position:fixed. So look at how fixed works, apply rules like that. Support is actually ok for newest browsers.

Canonical use case is table heading rows that stick to the top as you scrolldown the table; very useful on mobile particularly. Site headers as well loke this site is a common one, though that’s often kinda an antipattern

Ok,so much thanks guys!
Bye