© Jörg Krause 2020
J. KrauseIntroducing Bootstrap 4https://doi.org/10.1007/978-1-4842-6203-0_5

5. Forms

Jörg Krause1 
(1)
Berlin, Germany
 

Forms are fully supported in Bootstrap 4. Many of the components are primarily used to make the forms responsive, and can be used with any screen width.

Structure of a Form

Form elements automatically receive the correct formatting. The main class for controls is .form-control. Elements that have controllable horizontal extensions such as <input>, <textarea>, and <select> are set to a width of 100% of the parent container. The labels and inputs are grouped using .formgroup. They arrange themselves depending on the available width, either side-by-side or one above the other.

Simple Form Elements

Listing 5-1 gives an ...

Get Introducing Bootstrap 4: Create Powerful Web Applications Using Bootstrap 4.5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.