Webflow does not automatically make all slides equal height if they contain different content, which can cause layout shifts. Here's how to make all slides match the height of the tallest one.
.w-slide
element (the slide class).If content height varies significantly, CSS alone won’t equalize slide heights. Use this workaround:
Add a small custom script to detect the tallest slide after page load and set all slides to that height.
In Page Settings, paste this in the Footer Custom Code section:
``
Adjust the class name if you've renamed .w-slide
.
If your slides contain dynamic content that might shift on window resize, enhance the script:
Replace window.addEventListener("load",...)
with:
window.addEventListener("load", matchSlideHeights);
window.addEventListener("resize", matchSlideHeights);
And define the function:
`function matchSlideHeights() {
const slides = document.querySelectorAll(".w-slide");
let maxHeight = 0;
slides.forEach(slide => {
slide.style.height = "auto"; // reset height first
const h = slide.offsetHeight;
if (h > maxHeight) maxHeight = h;
});
slides.forEach(slide => {
slide.style.height = maxHeight + "px";
});
}`
To make all Webflow slides the same height as the tallest one, use flexbox layout, set slide height to 100%, and apply a JavaScript snippet to equalize heights at load and resize. This ensures a smoother and consistent slider experience.