Search code examples
csssidebar

How can I make a scrollable site with a fixed side bar?


I want to do a site so simple it hurts.

I need a fixed side bar with some links.

I need a main window with a scrollbar that scrolls only the main window, not the side bar altogether.

Can I do this without creating 3, 4 or 5 divs, mains, navs, asides, sections, articles or whatever?

Can I do this without more than 10, 20 or 30 lines of css?

The examples in this answer comes close to what I want. But to have 38 lines of CSS to something so simple seem just ridiculous.


Solution

  • This is a minimum setup for what you are trying to achieve: https://jsfiddle.net/jv891nv8/1/

    It simply have a content div, and a

    position: fixed
    

    sidebar. From here you can modify to what you like.