Back to CSS Search Boxes Glass Search Pure CSS
Share
HTML
<form class="csb-glass" role="search">
  <label class="csb-sr" for="csb-glass-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-glass-i" type="search" name="q" placeholder="Search..." />
</form>
CSS
.csb-glass {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background 0.25s, border-color 0.25s;
}
.csb-glass:focus-within { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.32); }
.csb-glass svg { width: 16px; height: 16px; fill: none; stroke: rgba(255,255,255,0.7); stroke-width: 2; stroke-linecap: round; }
.csb-glass input {
  width: 220px; padding: 0;
  border: 0; outline: none; background: transparent;
  color: #fff; font: 500 14px/1 system-ui, sans-serif;
}
.csb-glass input::placeholder { color: rgba(255,255,255,0.55); }

.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;
}