Bootstrap 3.0 - Fluid Grid that includes Fixed Column Sizes

前端 未结 8 664
梦谈多话
梦谈多话 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:57

    edit: As lots of people seem to want to do this, I have written up a short guide with a more general use case here https://www.atlascode.com/bootstrap-fixed-width-sidebars/. Hope it helps.

    The bootstrap3 grid system supports row nesting which allows you to adjust the root row to allow fixed width side menus.

    You need to put in a padding-left on the root row, then have a child row which contains your normal grid layout elements.

    Here is how I usually do this http://jsfiddle.net/u9gjjebj/

    html

    Fixed 240px
    Fixed 160px
    Standard grid system content here

    css

    .col-fixed-240{
        width:240px;
        background:red;
        position:fixed;
        height:100%;
        z-index:1;
    }
    
    .col-fixed-160{
        margin-left:240px;
        width:160px;
        background:blue;
        position:fixed;
        height:100%;
        z-index:1;
    }
    
    .col-offset-400{
        padding-left:415px;
        z-index:0;
    }
    

提交回复
热议问题