Bootstrap Forms
Bootstrap provides several classes and components for creating forms, such as input fields, checkboxes, radio buttons, and more. These components are designed to be responsive and easy to customize.
Syntax
To use Bootstrap forms, you need to add the following classes to your HTML elements:
form-group
: this class is used to group form elements together.form-control
: this class is applied to input fields, textarea, and select elements to give them a uniform appearance.
Here is an example of how to create a simple Bootstrap form:
<form>
<div class="form-group">
<label for="nameInput">Name:</label>
<input type="text" class="form-control" id="nameInput" placeholder="Enter name">
</div>
<div class="form-group">
<label for="emailInput">Email address:</label>
<input type="email" class="form-control" id="emailInput" placeholder="Enter email">
</div>
<div class="form-group">
<label for="messageInput">Message:</label>
<textarea class="form-control" id="messageInput" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>