Bootstrap Form

by Abhishek 23-Jul-16

0 681


Bootstrap Form: Bootstrap's form controls expand on our Rebooted form styles with classes.

3 Types - Vertical Form, Horizontal Form, Inline Form

Examples:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Bootstrap Form </title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-Bootstrap css file->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">

</head>

<body>

<p> Bootstrap form creating without any base class </p>
<div class="col-md-2">

<!-Vertical form->

<form>
<div class="form-group">
<label> First Name </label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label> Last name </label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label> Message </label>
<textarea class="form-control"></textarea>
</div>
<div class="form-group">
<button type="button" class="btn btn-danger"> Submit </button>
</div>
</form>
</div>

<!-Horizontal form->

<div class="col-md-4">
<h3> Horizontal Form </h3>
<form class="form-horizontal">
<div class="form-group">
<label class="col-md-3"> First Name </label>
<div class="col-md-8">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3"> Last name </label>
<div class="col-md-8">
<input type="text" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3"> Message </label>
<div class="col-md-8">
<textarea class="form-control"></textarea>
</div>
</div>
<div class="form-group text-center">
<button type="button" class="btn btn-danger"> Submit </button>
</div>
</form>
</div>

<!-In-line form->

<div class="col-md-6">
<h3> In-Line Form </h3>
<form class="form-inline">
<div class="form-group">
<label> First Name </label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label> Last name </label>
<input type="text" class="form-control">
</div>

<div class="form-group">
<button type="button" class="btn btn-danger"> Submit </button>
</div>
</form>
</div>

<!-Bootstrap js file->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</body>

</html>


Share:


Comments

    No Comments Yet.

Leave a Reply