→ static -
Different position values:
→ static
→ relative
→ absolute
→ fixed
→ sticky
→ inherit
positional properties:
z-index -
any of the valid CSS unit (px, rem, vw, vh etc)
a percentage of the of the containing element’s height (for top and bottom) or width (for left and right)
→ relative -
→ absolute -
→ fixed -
→ sticky -
→ inherit -
Twitter web app scroll implementation:
Fixed Navigation Bar:
.nav-bar
is set to position: fixed;
, which keeps it at the top of the viewport at all times during scrolling.Main Feed Section:
.feed-section
contains multiple "tweets." This section scrolls normally with the page,Sticky Right Sidebar:
.right-sidebar
contains sticky content. Using position: sticky;
on the .sticky-content
and setting top: 70px;
, this content sticks to the top of the sidebar as you scroll, but once you reach the end of its content, it stops scrolling.Facebook web app scroll implementation:
Main Feed Scrolling:
Left Sidebar:
Right Sidebar: