Lesson 36: Form Floating Label in Bootstrap 5
Floating labels are a feature that lets you create simple form labels that stand out above input fields. Here's how to create floating labels in Bootstrap 5.
Floating labels are a feature that lets you create simple form labels that stand out above input fields. Here's how to create floating labels in Bootstrap 5 .
How to create floating and dynamic labels
By default, when using labels, they usually appear at the top of the input field:
With floating labels, you can insert labels inside input fields, making them float/move when the input field is clicked. Sample code:
For example:
Note on floating labels: Elements must be placed after thetag, and the attribute placeholderis needed for the element (even if it's not visible).
Text field
It also works with text input areas. Sample code:
- Lesson 38: Grid Systems from Stacked to Horizontal in Bootstrap 5
- Lesson 30: Flexing in Bootstrap 5
- Lesson 15: Pagination in Bootstrap 5
- Lesson 4: Typography in Bootstrap 5
- Lesson 29: Utilities in Bootstrap 5
- Lesson 39: Ultra-Small Grid Styles in Bootstrap 5
- Lesson 20: Navs in Bootstrap 5
- Lesson 1: What is Bootstrap 5? How to get started?
- Lesson 41: Grid Medium in Bootstrap 5
- Lesson 19: How to use Collapse in Bootstrap 5
- Lesson 24: Tooltips in Bootstrap 5
- Lesson 40: Small Grid in Bootstrap 5
- Lesson 26: Toast in Bootstrap 5
- Lesson 16: List Groups in Bootstrap 5