32 CSS Search Box & Search Bar Designs
Pill with Submit
Rounded pill shell with an inline submit button — the de facto pattern for site search and product search.
Pill with Submit the 2nd of 32 designs in the 32 CSS Search Box & Search Bar Designs collection. The design is implemented in pure CSS — no JavaScript required. Copy the HTML and CSS panels below into your project. Because the demo is pure CSS, it works in any framework or templating engine you happen to use. The design honours prefers-reduced-motion and uses real semantic markup, so it ships accessibility-ready out of the box.
Live preview
The code
<form class="csb-pill" role="search">
<label class="csb-sr" for="csb-pill-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-pill-i" type="search" name="q" placeholder="Search products..." />
<button type="submit">Search</button>
</form> .csb-pill {
display: inline-flex; align-items: center;
background: #1a1a28;
border: 1px solid rgba(255,255,255,0.08);
border-radius: 999px;
padding: 4px 4px 4px 14px;
transition: border-color 0.2s, background 0.2s;
}
.csb-pill:focus-within { border-color: #7c6cff; background: #1f1f28; }
.csb-pill svg { width: 16px; height: 16px; fill: none; stroke: #7a7899; stroke-width: 2; stroke-linecap: round; }
.csb-pill input {
flex: 1; min-width: 180px; padding: 8px 12px;
border: 0; outline: none; background: transparent;
color: #f0eeff; font: 500 13px/1 system-ui, sans-serif;
}
.csb-pill input::placeholder { color: #b8b6d4; }
.csb-pill button {
padding: 8px 18px; border: 0; cursor: pointer;
background: linear-gradient(135deg, #7c6cff, #a78bfa);
color: #fff; font: 600 12px/1 system-ui, sans-serif;
border-radius: 999px;
}
.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;
}