Skip to content

Minimal Floating Label

Clean, modern design with labels that float up when typing

Minimal Floating Label

by FreeCsStyles Dev's

ModernCSS
🌐
#floating#labels#animation

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/floating-label.

<iframe src="/embed/floating-label" sandbox="allow-scripts" loading="lazy" title="Minimal Floating Label" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Minimal Floating Label. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.

HTML
<div class="form-group">
  <input type="text" id="name" required>
  <label for="name">Full Name</label>
</div>
CSS
.form-group {
  position: relative;
  margin-bottom: 2rem;
}
.form-group input {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: transparent;
}
.form-group input:focus {
  border-color: #6C63FF;
  outline: none;
}
.form-group label {
  position: absolute;
  left: 0.8rem;
  top: 0.8rem;
  color: #999;
  transition: all 0.3s ease;
  pointer-events: none;
  background: white;
  padding: 0 0.3rem;
}
.form-group input:focus ~ label,
.form-group input:valid ~ label {
  top: -0.7rem;
  font-size: 0.8rem;
  color: #6C63FF;
  font-weight: 600;
}

Topics

  • #floating
  • #labels
  • #animation