.w-tab-link
elements.If tab content isn’t scrolling to the top when switching tabs in Webflow, and tab elements aren't behaving consistently within containers, these are likely issues with default tab behavior and layout structure. Here's how to fix both problems.
By default, Webflow doesn’t scroll the viewport to the top of newly shown tab content. This can be confusing for users, especially on mobile.
Add Custom Code to scroll to the top each time a new tab is clicked.
Go to Page Settings > Before
tag and insert this script:
This script targets all Tab Links and forces the window to scroll to the top when any is clicked.
Use this code inline:<script>document.querySelectorAll('.w-tab-link').forEach(tab => tab.addEventListener('click', function() { window.scrollTo({ top: 0, behavior: 'smooth' }); }));</script>
Make sure your tab links use the class w-tab-link (default in Webflow). If renamed, replace the selector with your custom class.
To make Tab elements behave like other elements inside containers:
If your tab content varies in height, add styling and optional script to prevent layout jumps:
To fix tab content not scrolling to the top, add a scroll script targeting tab click events. To make Tab elements behave like other components, ensure they’re nested inside a container or div with standard layout behavior, and adjust layout styles to prevent overflow or display issues.