Back to CSS Search Boxes Dual Tone Outline Pure CSS
Share
HTML
<form class="csb-dual" role="search">
  <label class="csb-sr" for="csb-dual-i">Search</label>
  <input id="csb-dual-i" type="search" name="q" placeholder="Search..." />
</form>
CSS
.csb-dual {
  position: relative; display: inline-block;
  padding: 1.5px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.08) 50%, #7c6cff 50%, #7c6cff 100%);
  background-size: 200% 100%;
  background-position: 0% 0%;
  border-radius: 10px;
  transition: background-position 0.4s ease;
}
.csb-dual:focus-within { background-position: 100% 0%; }
.csb-dual input {
  display: block;
  width: 240px; padding: 11px 14px;
  border: 0; outline: none;
  background: #1a1a28;
  border-radius: 9px;
  color: #f0eeff; font: 500 14px/1 system-ui, sans-serif;
}
.csb-dual 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;
}