Bootstrap 4 Tutorial
Customized form components included with Bootstrap 4 are meant to take the place of the browser’s default elements.
Wrap a container element, such as <div>, with the classes .custom-control and .custom-checkbox around the checkbox to create a custom checkbox. Next, include the .custom-control-input in the input that has the type=”checkbox” attribute.
Tip: Include the .custom-control-label class in labels if you plan to use them for accompanying content. Keep in mind that the for attribute’s value and the checkbox’s id must match:
Toggle me
Wrap a checkbox in a container element (such as <div>) with the classes .custom-control and .custom-switch to create a custom “toggle switch”. Next, give the checkbox the .custom-control-input class:
Wrap a container element, such as <div>, with the classes.custom-control and.custom-radio around the radio button to create a custom radio button. Next, include the.custom-control-input in the input that has the type=”radio” attribute.
Tip: Add the .custom-control-label class to it if you plan to utilize labels for the accompanying content. Keep in mind that the radio’s id and the value of the for property must match:
Add the .custom-control-inline to the wrapper/container if you want the custom form controls to be inline, or side by side:
Add the .custom-select class to the <select> element to create a custom select menu:
To make a small choose menu, use the .custom-select-sm class, and to make a large one, use the .custom-select-lg class:
Add the .custom-range class to an input with type=”<range>” to create a custom range menu:
Wrap a container element around the input with type=”file” and a class of .custom-file to create a custom file upload. Next, give it the .custom-file-input extension.
Advice: Include the .custom-file-label class in labels if you plan to use them for accompanying text. Keep in mind that the checkbox’s id and the value of the for property must match:
It should be noted that additional jQuery code is required if you like the file name to show up when you choose a certain 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.