Skip to content
Justice Tech School

Floating Labels

Wrap an input and label in .form-floating and the label floats above the text when the field is filled. The input needs a placeholder.

Example
<div class="form-floating mb-3">
  <input type="email" class="form-control" id="f" placeholder="name@example.com">
  <label for="f">Email address</label>
</div>

Exercise

Wrapper class.

form-

Quiz Test

Which attribute must the input have?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.