Back to CSS Search Boxes Avatar Search Pure CSS
Share
HTML
<form class="csb-avatar" role="search">
  <label class="csb-sr" for="csb-avatar-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-avatar-i" type="search" name="q" placeholder="Search your workspace..." />
  <span class="csb-avatar-pic" aria-hidden="true">VC</span>
</form>
CSS
.csb-avatar {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 5px 5px 14px;
  background: #1a1a28;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  min-width: 280px;
}
.csb-avatar:focus-within { border-color: #7c6cff; }
.csb-avatar svg { width: 15px; height: 15px; fill: none; stroke: #7a7899; stroke-width: 2; stroke-linecap: round; }
.csb-avatar input {
  flex: 1; padding: 8px 0;
  border: 0; outline: none; background: transparent;
  color: #f0eeff; font: 500 13px/1 system-ui, sans-serif;
}
.csb-avatar input::placeholder { color: #b8b6d4; }
.csb-avatar-pic {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c6cff, #ff6c8a);
  color: #fff; font: 700 11px/1 system-ui, sans-serif;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

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