To create a scroll-based sticky element in Webflow—like the share widget on the Webflow blog—you need to use position sticky on the element and set the container section’s height appropriately to constrain the scroll. Here's how to do it:
1. Add the Sticky Element Inside a Section
- Place your sticky element (e.g., social share buttons) inside a section or div block.
- This parent wrapper must be the container that defines the scroll boundary for the sticky element.
2. Set the Sticky Element to “Position: Sticky”
- Select the element you want to make sticky (e.g.,
.share-widget
). - In the Style panel, go to the Position section.
- Set it to Sticky, and set a top offset value (e.g.,
top: 20px
). - This value defines how far from the top of the viewport the element will stick.
- The element will remain sticky until the parent container ends.
- Ensure the parent section or div has enough height or vertical scroll area. You can do this by:
- Placing long content side-by-side (columns/flex) next to the sticky item.
- Setting the wrapper container to Display: Flex or Grid to align child elements correctly and avoid layout breaking.
4. Use Flex or Grid for Side-by-Side Layout
- Select the parent container (e.g.,
.blog-wrapper
) and set it to Display: Flex (horizontal). - Add your main content (e.g., article body) and the sticky element as flex children.
- Adjust widths appropriately for responsive behavior.
5. Test Across Viewports
- Sticky behavior works in most modern browsers but can behave differently on mobile.
- On mobile, sticky elements might not perform well, so you may want to hide the sticky element using visibility settings (e.g., Display: none on smaller breakpoints).
Summary
To replicate a sticky scrolling element like the Webflow blog’s share button, use position: sticky with a top offset inside a properly sized container. Ensure the parent layout supports side-by-side content (using Flex or Grid), and test for responsiveness.