Bootstrap 4 Tutorial
Text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color are among the HTML5 input types that Bootstrap supports.
Note: If an input’s type is not correctly stated, it will not be fully styled!
One input element of type=”text” and one of type=”password” are shown in the following example. We utilize the .form-control class, as we discussed in the Forms chapter, to style inputs with full-width, appropriate padding, etc.
The sample that follows has a textarea:
If you want the user to be able to choose from a list of pre-selected options, you utilize checkboxes.
Three checkboxes can be found in the sample that follows. The final option is not active:
To guarantee that labels and checkboxes have the correct margins, use a wrapper element with class=”form-check”.
To properly style checkboxes inside the .form-check container, add the .form-check-input class and the .form-check-label class to label elements.
If the checkboxes should show up on one line, use the .form-check-inline class:
If you want to restrict the user to choose only one choice from a list of pre-selected options, you can use radio buttons.
Three radio buttons can be found in the example below. The final option is not active:
Similar to checkboxes, if you want the radio buttons to show up on one line, use the .form-check-inline class:
If you wish to give the customer a choice between several options, you can utilize select lists.
The dropdown list (also known as the pick list) in the example below
Modify the form control’s size by using. The .form-control-sm or .form-control-lg construct.
If you wish to style the input field as plain text, use the .form-control-plaintext:
To style a range control or a file field with full-width, add the .form-control-range class to input type “range” or the .form-control-file class to input type “file”:
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.