Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap way to add vertical space between the fields

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>
like image 496
beginner Avatar asked Nov 15 '25 17:11

beginner


2 Answers

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>
           
like image 175
Rohit Verma Avatar answered Nov 18 '25 09:11

Rohit Verma


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

like image 31
Rémy Testa Avatar answered Nov 18 '25 10:11

Rémy Testa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!