Bootstrap 3.0 - Fluid Grid that includes Fixed Column Sizes

前端 未结 8 605
梦谈多话
梦谈多话 2020-11-29 16:37

I am learning how to use Bootstrap. Currently, I\'m wading my way through layouts. While Bootstrap is pretty cool, everything I see seems dated. For the life of me, I have w

8条回答
  •  無奈伤痛
    2020-11-29 16:58

    Updated 2018

    IMO, the best way to approach this in Bootstrap 3 would be using media queries that align with Bootstrap's breakpoints so that you only use the fixed width columns are larger screens and then let the layout stack responsively on smaller screens. This way you keep the responsiveness...

    @media (min-width:768px) {
      #sidebar {
          width: inherit;
          min-width: 240px;
          max-width: 240px;
          min-height: 100%;
          position:relative;
      }
      #sidebar2 {
          min-width: 160px;
          max-width: 160px;
          min-height: 100%;
          position:relative;
      }
      #main {
          width:calc(100% - 400px);
      }
    }
    

    Working Bootstrap Fixed-Fluid Demo

    Bootstrap 4 will has flexbox so layouts like this will be much easier: http://www.codeply.com/go/eAYKvDkiGw

提交回复
热议问题