To create a horizontally scrolling section in Webflow while keeping the content centered using the CSS sticky effect, you’ll need to combine flex layout, overflow control, and sticky positioning.
1. Set Up the Sticky Section Container
- Add a section element and give it a class (e.g.,
sticky-horizontal-section
). - Set the position to sticky and attach it to top: 0.
- Give it a height of 100vh to fill the screen.
- Set the overflow to hidden to constrain scrolling visuals.
- Inside the sticky section, insert a div (e.g.,
scroll-wrapper
). - Set this wrapper’s display to flex and the flex-direction to row.
- Set overflow to visible, position to absolute or relative, and apply a width long enough (e.g., 400vw for 4 panels) to allow horizontal scrolling.
3. Add Scrollable Content Panels
- Inside the
scroll-wrapper
, add individual content blocks (e.g., panel-1
, panel-2
, etc.). - Set each panel to have width: 100vw and height: 100vh so they fill the screen one-by-one.
- Use flexbox alignment in each panel to center the content vertically and horizontally.
Webflow doesn’t support “pure horizontal” scroll natively with vertical scroll input, so replicate it by moving the section with scroll-based animation:
- Go to Page Trigger > While Page is Scrolling.
- Animate the
scroll-wrapper
’s translateX property to move left as the page scrolls down. - Set a scroll percentage-based animation that moves from
0%
(translateX: 0vw) to 100%
(translateX: -300vw for 4 panels total).
5. Adjust Body/Page Height for Scrolling Space
- The page needs enough scroll height to trigger the horizontal movement:
- Use a container div after your sticky section with enough height (e.g., 4 × 100vh = 400vh).
- Or wrap the sticky section in a large-height parent and pin the sticky section for scrolling effect duration.
6. Ensure Centered Content on All Screens
- For each content panel:
- Set display: flex with justify-content: center and align-items: center.
- Use max-width and padding as needed to ensure responsive design.
Summary
To make a section scroll horizontally while keeping content centered with a sticky effect in Webflow, create a sticky section with a wide flexbox wrapper, animate horizontal movement using a scroll-based animation, and center content using flex alignment. Always match scroll animation with overall page height to keep the experience smooth.