htmlcsstwitter-bootstrap

Bootstrap - 5 column layout


I'm trying to get 5 column full width layout but I can't find the solution that fits on my needs

Here's the code I use

  <!-- Content Section -->
    <div class="container">
      <div class="row">
        <div class="col-lg-12" style="border: 1px solid red">
          <div class="row">
            <div class="col-xs-12">
              <div class="col-xs-2 col-xs-offset-1" id="p1">One</div>
              <div class="col-xs-2" id="p2">Two</div>
              <div class="col-xs-2" id="p3">Three</div>
              <div class="col-xs-2" id="p4">Four</div>
              <div class="col-xs-2" id="p5">Five</div>
            </div>
            <!-- //col-lg-12 -->
          </div>
          <!-- //row -->
          lorem
        </div>
      </div>
      <!-- //col-lg-12 -->
    </div>
    <!-- //row -->
  </div>
  <!-- //container -->

As a result I get enter image description here

And here is what I'm trying to achieve. Full width 5 column layout with a space between each column enter image description here


Solution

  • UPDATE, 2021: for modern Bootstrap (4+), I recommend Zim's answer due to it's natural way of using Bootstrap flex classes

    .col-xs-2{
        background:#00f;
        color:#FFF;
    }
    .col-half-offset{
        margin-left:4.166666667%
    }
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
    <div class="container">
        <div class="row" style="border: 1px solid red">
            <div class="col-xs-2" id="p1">One</div>
            <div class="col-xs-2 col-half-offset" id="p2">Two</div>
            <div class="col-xs-2 col-half-offset" id="p3">Three</div>
            <div class="col-xs-2 col-half-offset" id="p4">Four</div>
            <div class="col-xs-2 col-half-offset" id="p5">Five</div>
            <div>lorem</div>
        </div>
    </div>

    This should be ok.