# Search Input

> A rounded search field with a built-in icon and a soft focus ring.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: search, input, icon, focus ring, pill
- Live preview: https://copy-css.com/snippets/search-input
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<input class="search-input" type="search" placeholder="Search…" aria-label="Search">
```

## CSS

```css
.search-input {
  box-sizing: border-box;
  width: 220px;
  padding: 12px 16px 12px 42px;
  border: 1.5px solid #e5e7eb;
  border-radius: 999px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 15px center / 18px;
  color: #111;
  font: 15px system-ui, sans-serif;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}
```

## Notes

- This CSS Search Input is 17 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses transitions and box shadows.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
