How to left column fixed and right scrollable in Bootstrap 4, responsive?

独自空忆成欢 提交于 2019-11-27 04:55:45

I'm not sure if you simply want a layout with 1 fixed side, or for the side to be fixed until it reaches the footer (like Trulia). Here's a simple layout with fixed left side (Split 50 50).

body, html {
    height: 100%;
}

#left {
    position: fixed;
    top: 0;
    bottom: 0;
}

https://www.codeply.com/go/IuOp3nvCpy

To make the side fixed (or sticky) only at a specific point, position:sticky doesn't work very well across all browsers. I'd use a plugin or polyfill as explained here: How to use CSS position sticky to keep a sidebar visible with Bootstrap 4

Update Bootstrap 4.0.0 - The fixed-top class is now in Bootstrap which can be used on the left side column to remove the extra css that was required for position:fixed.

Update Bootstrap 4.1 - The h-100 class is now available which eliminates the extra CSS that was needed for height:100%: https://www.codeply.com/go/ySC2l4xcEi

Responsive - As mentioned in the comments, a media query can be used to make the layout responsive: https://www.codeply.com/go/pqzJB4thBY


Related:
fixed col on right side
How to create a fixed sidebar layout with Bootstrap 4?
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!