3 Columns: Only middle column scrolls?

I’m trying to replicate something like the Yelp Map directory page.

I want the middle column to scroll, but the left and right column to stay fixed.

I’m thinking the right way to do it is to:

  1. Set the outer container to Height:100vh, and use javascript to set the main container’s height to be 100vh minus the height of the header and footer.

  2. Set the middle column to overflow-y:auto

  3. Set the 1st and third column to height:100%

Am I on the right track?

I’ve not tried yet, but I don’t foresee any need for that, the main content can be largley left to nature, with the exception of some fat side margins to dodge the side panels. No need for javascript.
It’s more a case of making the side panels fixed with 100vh height and top margin to dodge the fixed header.

You can also try inspecting that site to see how they did it.

1 Like

No need for javascript as css can handle this easily. :slight_smile:

Here’s one very quick example using sticky columns.

There are many other ways and variations that can be catered for but does depend on the exact dynamics.

Here’s one that mimics the page you linked to and the bottom of the side columns only show when you have scrolled the middle column.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.