Bootstrap4 Forms
In this chapter, we will learn how to create forms with Bootstrap. Bootstrap can create forms of different styles using simple HTML tags and extended classes.
Form Element ,
Bootstrap4 form layouts
- Stacked form (full width): vertical direction
- Inline form: horizontal direction
Bootstrap provides two types of form layouts:
Stacked forms
The following example uses two input boxes, one checkbox, and one submit button to create a stacked form:
Example
<form action="">
<div class="form-group">
<label for="email">Email address:
</
label
<
input
type
=
"
email
"
class
=
"
form-control
"
placeholder
=
"Enter email
"
id
=
"
"
</
div
<
div
class
=
"
form-group
"
<
label
for
=
"
pwd
"Password:
</
label
<
input
type
=
"
password
"
class
=
"
form-control
"
placeholder
=
"Enter password
"
id
=
"
pwd
"
</
div
<
div
class
=
"form-group form-check
"
<label class="form-check-label">
<input class="form-check-input" type="checkbox">Remember me
</
label
</
div
<
button
type
=
"
submit
"
class
=
"btn btn-primary
"
Submit
</
button
</
formTry it »
Display effect:

Inline form
All elements in an inline form are left-aligned.
Note: it is stacked vertically when the screen width is less than 576px; form elements will only be displayed on the same horizontal line when the screen width is greater than or equal to 576px.
Inline forms require