Back to CSS Search Boxes Floating Card Pure CSS
Share
HTML
<form class="csb-card" role="search">
  <label class="csb-sr" for="csb-card-i">Search</label>
  <svg viewBox="0 0 24 24" aria-hidden="true">
    <circle cx="11" cy="11" r="7" />
    <path d="m20 20-3.5-3.5" />
  </svg>
  <input id="csb-card-i" type="search" name="q" placeholder="Search..." />
</form>
CSS
.csb-card {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: #1f1f28;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transform: scale(1) translateY(0);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
}
.csb-card:focus-within {
  transform: scale(1.02) translateY(-3px);
  box-shadow: 0 12px 32px rgba(124,108,255,0.3), 0 4px 8px rgba(0,0,0,0.4);
}
.csb-card svg { width: 16px; height: 16px; fill: none; stroke: #a78bfa; stroke-width: 2; stroke-linecap: round; }
.csb-card input {
  width: 220px; padding: 0;
  border: 0; outline: none; background: transparent;
  color: #f0eeff; font: 500 14px/1 system-ui, sans-serif;
}
.csb-card input::placeholder { color: #b8b6d4; }

.csb-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}