Search code examples
csstwitter-bootstrapmultiple-columnssidebar

How to Customize Bootstrap Column Widths?


I have this, but I feel 4 is too big for my sidebar width and 3 is too small (it has to add up to 12).

  <div class="col-md-8">
  <div class="col-md-4">

I tried this but it doesn't work:

  <div class="col-md-8.5">
  <div class="col-md-3.5">

Is there another way to get a similar outcome?

Thanks for your help!


Solution

  • To expand on @isherwood's answer, here is the complete code for creating custom -sm- widths in Bootstrap 3.3

    In general you want to search for an existing column width (say col-sm-3) and copy over all the styles that apply to it, including generic ones, over to your custom stylesheet where you define new column widths.

    .col-sm-3half, .col-sm-8half {
        position: relative;
        min-height: 1px;
        padding-right: 15px;
        padding-left: 15px;
    }
    
    @media (min-width: 768px) {
        .col-sm-3half, .col-sm-8half {
            float: left;
        }
        .col-sm-3half {
            width: 29.16666667%;
        }
        .col-sm-8half {
            width: 70.83333333%;
        }
    }