Back to CSS Search Boxes Focus Ring Bloom Pure CSS
Share
HTML
<form class="csb-bloom" role="search">
  <label class="csb-sr" for="csb-bloom-i">Search</label>
  <input id="csb-bloom-i" type="search" name="q" placeholder="Search..." />
</form>
CSS
.csb-bloom {
  position: relative; display: inline-block;
}
.csb-bloom input {
  width: 240px; padding: 11px 14px;
  background: #1a1a28;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #f0eeff; font: 500 14px/1 system-ui, sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.csb-bloom input::placeholder { color: #b8b6d4; }
.csb-bloom::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(124,108,255,0.6);
}
.csb-bloom:focus-within input { border-color: #7c6cff; }
.csb-bloom:focus-within::after {
  animation: csb-bloom-pulse 1.6s ease-out infinite;
}
@keyframes csb-bloom-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(124,108,255,0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(124,108,255,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;
}

@media (prefers-reduced-motion: reduce) {
  .csb-bloom,
  .csb-bloom * {
    animation: none !important;
  }
}