bootstrap form grid code example

Example 1: bootstrap forms

<form>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
    <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
  </div>
  <div class="form-check">
    <input type="checkbox" class="form-check-input" id="exampleCheck1">
    <label class="form-check-label" for="exampleCheck1">Check me out</label>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>

Example 2: bootstrap grid

<div class="container">
  <div class="row">
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
    <div class="col-sm">
      One of three columns
    </div>
  </div>
</div>

Example 3: bootstrap grid

<!----------------------- BOOTSTRAP GRID SYSTEM ------------------------>

This code will create 4 boxes placed side by side, which will be 
dynamically positioned, according to the size of the screen. We define 
the following behavior: 


<!-- Desktop Display: we have 4 columns per row (each occupies 3 units out of 12)  -->

class = "col-lg-3"   <!-- display large with 12/3 = 4 columns -->


<!-- Tablet Display: we have 3 columns per row (each occupies 4 units out of 12)  -->

class = "col-md-4"   <!-- display medium with 12/4 = 3 columns -->


<!-- Mobile Display: we have 2 columns per row (each occupies the 6 units of 12)  -->

class = "col-sm-6"  <!-- display small with 12/6 = 2 columns -->


<!-- CODE -->

  <div class="row">
    <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:red; border:1px solid black;">
      One of four columns
    </div>
    <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:yellow; border:1px solid black;">
      One of four columns
    </div>
    <div class="col-lg-3 col-md-4 col-sm-6" style="background-color:green; border:1px solid black;">
      One of four columns
  	</div>
    <div class="col-lg-3 col-md-4 col-sm-6" style="border:1px solid black;">
      One of four columns
  	</div>
  </div>

Example 4: bootstrap forms

Example of .form-group
<form>
 <div class=”form-group”>
 <label for=”exampleInputEmail1”>Email 

address</label>
 <input type=”email” class=”form-control” id=”exampleInputEmail1” ariadescribedby=”emailHelp” placeholder=”Provide email”>
 </div>
 <div class=”form-group”>
 <label for=”exampleInputPassword1”>Your password</label>
 <input type=”password” class=”form-control” id=”exampleInputPassword1”
placeholder=”Password”>
 </div>
 <div class=”form-group form-check”>
 <input type=”checkbox” class=”form-check-input” id=”exampleCheck1”>
 <label class=”form-check-label” for=”exampleCheck1”>Remember me</label>
 </div>
 <button type=”submit” class=”btn btn-primary”>Submit</button>
</form>
.form-control
Use this class to style all textual form controls such as user input, titles, etc.
<form>
 <div class=”form-group”>
 <label for=”exampleFormControlInput1”>Email address</label>
 <input type=”email” class=”form-control” id=”exampleFormControlInput1”
placeholder=[email protected]>
 </div>
.form-control-file
Add this class whenever you need to provide the user with an option to upload a file to the form.
<input type=”file” class=”form-control-file” id=”exampleFormControlFile1”>
.form-control-lg and .form-control-sm.
Create a visual hierarchy within your form by adding .form-control-lg to make bigger input areas and .form-control-sm to
make smaller ones.
<input class=”form-control form-control-lg” type=”text” placeholder=”.form-controllg”>
<input class=”form-control form-control-sm” type=”text” placeholder=”.form-controlsm”>

Tags:

Misc Example