2

How can I add vertical space between the div's. Is there any bootstrap class I can add here? Any help?

Below is the snippet from my code:

<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            <label class="control-label col-lg-4"> Project: </label>
            <div class="col-lg-8">
                @Html.TextBoxFor(model => model.detailsConfig.Project, new { onkeypress = "return isNumberKey(event)", @class = "form-control", id = "Project" })
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-6">
        <div class="form-group">
            <label class="control-label col-lg-4">Quantity:</label>
            <div class="col-lg-8">
                @Html.TextBoxFor(model => model.detailsConfig.Quantity, new { onkeypress = "return isNumberKey(event)", @class = "form-control", id = "Quantity" })
            </div>
        </div>
    </div>
</div>
Minal Chauhan
  • 5,982
  • 8
  • 20
  • 39
beginner
  • 283
  • 1
  • 10
  • 29
  • 1
    Possible duplicate of [Twitter Bootstrap - add top space between rows](https://stackoverflow.com/questions/10085723/twitter-bootstrap-add-top-space-between-rows) – Rémy Testa Aug 02 '17 at 13:06

4 Answers4

4

You need to use <div class="form-group"> as parents like this

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="form-group">
<div class="row">
<div class="col-md-12">
            <div class="col-md-6">
              
                    <label class="control-label col-lg-4"> Project: </label>
                    <div class="col-lg-8">
                        @Html.TextBoxFor(model => model.detailsConfig.Project, new { onkeypress = "return isNumberKey(event)", @class = "form-control", id = "Project" })
                    </div>
                    </div>
            </div>
            </div>

        </div>

  <div class="form-group">
     <div class="row">
     <div class="col-md-12">
            <div class="col-md-6">
              
                    <label class="control-label col-lg-4">Quantity:</label>
                    <div class="col-lg-8">
                        @Html.TextBoxFor(model => model.detailsConfig.Quantity, new { onkeypress = "return isNumberKey(event)", @class = "form-control", id = "Quantity" })
                    </div>
                </div>
            </div>
</div>
           </div>
           
Rohit Verma
  • 3,407
  • 4
  • 27
  • 58
1

There are no class in the bootstrap toolbox to do this.

So the best way to do it's to add a top-buffer class on your row.

.top-buffer{
  margin-top: 40px;
}

Here the codepen : https://codepen.io/boydow/pen/ayZeGW

Rémy Testa
  • 869
  • 1
  • 10
  • 22
0

You can add the class "mt-#" or to your divs to add top margin, where # is a number between 1-5, varying in lengths. If you want to add margin to the top and bottom, you can do "my-#." This class is part of Bootstrap documentation.

<div class="your-class mt-3">Your column</div>
Adam H
  • 152
  • 8
0

You could use this : <div class="d-flex align-content-around flex-wrap">

Ridge
  • 11
  • 1