4

I want to add space between this columns, how can I do it with bootstrap.

<div class="container">
    <h1 class="my_h">title</h1>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-4">
                    <div>Widget 1</div>
                </div>
                <div class="col-md-4">
                    <div>Widget 2</div>
                </div>
                <div class="col-md-4">
                    <div>Widget 3</div>
                </div>
            </div>
        </div>
</div>

4 Answers 4

7

You can use col-md-offset-*:

<div class="container">
    <h1 class="my_h">title</h1>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-4 col-md-offset-2">
                    <div>Widget 1</div>
                </div>
                <div class="col-md-4">
                    <div>Widget 2</div>
                </div>
                <div class="col-md-4">
                    <div>Widget 3</div>
                </div>
            </div>
        </div>
</div>

You can read more about this here.

Sign up to request clarification or add additional context in comments.

Comments

1

Try this with css and offset

 .widget-box {
      padding: 20px 5px;
    }

<div class="container">
  <h1 class="my_h">title</h1>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-4">
        <div class="widget-box">Widget 1</div>
      </div>
      <div class="col-md-4">
        <div class="widget-box">Widget 2</div>
      </div>
      <div class="col-md-4">
        <div class="widget-box">Widget 3</div>
      </div>
    </div>
  </div>
</div>

OR

Set offset

<div class="container">
  <h1 class="my_h">title</h1>
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-3 col-md-offset-1">
        <div class="widget-box">Widget 1</div>
      </div>
      <div class="col-md-3 col-md-offset-1">
        <div class="widget-box">Widget 2</div>
      </div>
      <div class="col-md-3">
        <div class="widget-box">Widget 3</div>
      </div>
    </div>
  </div>
</div>

Comments

1

Bootstrap always uses 15px padding on columns to separate the content of the columns.

So there is a standard 30px space between column content

Comments

0

Suggested solution for a long-term, personalised fix

If you are looking to maintain the 12-column grid system, and not use empty columns to create the spacing you're looking for, the best solution for you would be to customize your own settings for Bootstrap.

Most specifically, this link: http://getbootstrap.com/customize/#grid-system

Quick and dirty fix

If, on the other hand, you want to use empty columns, the offset classes are here for you. Bear in mind you will probably struggle to align 3 columns correctly:

<div class="container">
    <h1 class="my_h">title</h1>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-3 col-md-offset-2">
                    <div>Widget 1</div>
                </div>
                <div class="col-md-3 col-md-offset-1">
                    <div>Widget 2</div>
                </div>
                <div class="col-md-3">
                    <div>Widget 3</div>
                </div>
            </div>
        </div>
</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.