Skip to content

Design3 min read

How to Create Floating Labels on Webflow Inputs

Learn how to create floating labels on Webflow inputs with CSS transitions and JavaScript.

In this tutorial, Sandro, cofounder of Gemeos Webflow agency, shows you how to create floating labels on Webflow inputs: the label lifts above the field when the user starts typing.

Example

ClassElementState
form-fieldWrapper div (label + input)Relative container
form-labelLabelAbsolute position, moves on focus
is-filledform-fieldAdded when the input has a value

1. HTML structure in an Embed

Create the structure below in a Webflow Embed. The label and the input need to live in the same relative container.

<div class="form-field">
  <label class="form-label">Email</label>
  <input type="email" class="form-input">
</div>

2. The CSS

.form-field { position: relative; padding-top: 16px; }
.form-label {
  position: absolute;
  top: 28px;
  left: 12px;
  font-size: 16px;
  color: #9ca3af;
  transition: all 0.2s ease;
  pointer-events: none;
}
.form-field.is-filled .form-label,
.form-field:focus-within .form-label {
  top: 2px;
  font-size: 11px;
  color: #6b7280;
}

3. The script

document.querySelectorAll('.form-field').forEach(function(field) {
  var input = field.querySelector('input, textarea');
  if (!input) return;
  function toggle() {
    field.classList.toggle('is-filled', input.value.length > 0);
  }
  input.addEventListener('input', toggle);
  input.addEventListener('blur', toggle);
  toggle();
});

Conclusion

Floating labels improve the UX of dense forms. See also: designing frictionless forms.

Published on May 19, 2026

Sandro DA SILVA

Growth Marketer, Webflow expert, and jack-of-all-trades. Sandro handles commercial operations, ensures projects run smoothly, and addresses marketing-related issues (SEO, Tracking, Copywriting, etc).

You're going to working with us, guaranteed

Ready to launch your business?

get a quote

Let’s f*****G GO !!