Bootstrap Tutorial - Create a vertical form








The following code shows how to create a vertical form.

Example

<!-- ww w.j  a v  a2s.  c  om-->
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script
  src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script
  src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

</head>
<body style='margin:30px'>
    <div class="container">
      <div class="row">
        <div class="col-xs-4">
          <form class="form">
              <div class="form-group">
                  <label for="nameField">Name</label>
                  <input type="text" class="form-control" id="nameField" placeholder="Your Name" />
              </div>
          
              <div class="form-group">
                  <label for="emailField">Email</label>
                  <input type="email" class="form-control" id="emailField" placeholder="Your Email" />
              </div>
          
              <div class="form-group">
                  <label for="phoneField">Phone</label>
                  <input type="text" class="form-control" id="phoneField" placeholder="Your Phone Number" />
              </div>
          
              <div class="form-group">
                  <label for="descField">Description</label>
                  <textarea type="text" class="form-control" id="descField" placeholder="Your Comments"></textarea>
              </div>
              
              <button type="submit" class="btn btn-primary">Submit</button> <button type="reset" class="btn btn-default">Reset</button>
          </form>
        </div>
      </div>
    </div>
</body>
</html>

Click to view the demo