![]() |
VOOZH | about |
The Bootstrap 5 Floating labels Component Selects is used to give a floating label to input fields. It also works with the HTML 5 <select> component. When we apply a floating label to the select component the label will always be shown in the floating state irrespective of the state of the select. The floating labels do not work with the size and multiple variations of the select element. However, they support the disabled select element.
Bootstrap 5 Floating labels Component Selects classes:
Bootstrap 5 Floating labels Component Selects attributes:
Syntax:
<div class="form-floating">
<select id="gfg" class="form-select">
...
</select>
<label for="gfg">Floating label</label>
</div>
Example 1: This is a basic example showing a floating label for the select element.
Output:
Example 2: In this example, the floating label is shown for the disabled select element.
Output:
Reference: https://getbootstrap.com/docs/5.2/forms/floating-labels/#selects