Back to CSS Search Boxes Inset Pressed Pure CSS
Share
HTML
<form class="csb-inset" role="search">
  <label class="csb-sr" for="csb-inset-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-inset-i" type="search" name="q" placeholder="Search..." />
</form>
CSS
.csb-inset {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: #15151d;
  border: 1px solid #0c0c12;
  border-radius: 10px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.04);
  transition: box-shadow 0.2s;
}
.csb-inset:focus-within {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 0 2px rgba(124,108,255,0.3);
}
.csb-inset svg { width: 15px; height: 15px; fill: none; stroke: #6b6987; stroke-width: 2; stroke-linecap: round; }
.csb-inset input {
  width: 220px; padding: 0;
  border: 0; outline: none; background: transparent;
  color: #f0eeff; font: 500 14px/1 system-ui, sans-serif;
}
.csb-inset 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;
}