Skip to content

Animated Underline

Elegant form with animated bottom border on focus

Animated Underline

by FreeCsStyles Dev's

ModernCSS
🌐
#underline#animation#minimal

Embed this component

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

<iframe src="/embed/animated-underline" sandbox="allow-scripts" loading="lazy" title="Animated Underline" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

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

HTML
<div class="underline-form">
  <input type="text" class="underline-input" required>
  <span class="underline-bar"></span>
  <label>Full Name</label>
</div>
CSS
.underline-input {
  width: 100%;
  padding: 0.5rem 0;
  border: none;
  border-bottom: 2px solid #ddd;
  background: transparent;
}
.underline-input:focus {
  outline: none;
  border-bottom-color: #6C63FF;
}
.underline-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #6C63FF;
  transition: width 0.3s ease;
}
.underline-input:focus ~ .underline-bar {
  width: 100%;
}

Topics

  • #underline
  • #animation
  • #minimal