Minimal Search Bar with Category Dropdown
A clean search component with category filtering, rounded input field, and subtle shadow effect.
HTML / CSS
<style>
.search-container {
display: flex;
max-width: 600px;
margin: 20px auto;
box-shadow: 0 2px 10px rgba(0,0,0,0.08);
border-radius: 50px;
overflow: hidden;
background: white;
transition: box-shadow 0.3s ease;
}
.search-container:focus-within {
box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}
.category-dropdown {
position: relative;
border-right: 1px solid #eee;
}
.category-dropdown select {
appearance: none;
background: transparent;
border: none;
padding: 14px 20px;
padding-right: 38px;
font-size: 14px;
color: #555;
cursor: pointer;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
outline: none;
}
.category-dropdown::after {
content: "⌄";
position: absolute;
right: 18px;
top: 50%;
transform: translateY(-50%);
color: #777;
pointer-events: none;
}
.search-input {
flex-grow: 1;
padding: 14px 20px;
border: none;
font-size: 16px;
outline: none;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
color: #333;
}
.search-input::placeholder {
color: #999;
}
.search-button {
background: #4a6cf7;
border: none;
color: white;
padding: 0 28px;
cursor: pointer;
font-size: 16px;
transition: background 0.2s ease;
}
.search-button:hover {
background: #3a5ae6;
}
</style>
<div class="search-container">
<div class="category-dropdown">
<select>
<option>All categories</option>
<option>Electronics</option>
<option>Fashion</option>
<option>Home & Garden</option>
<option>Books</option>
</select>
</div>
<input type="text" class="search-input" placeholder="Search...">
<button class="search-button">Search</button>
</div>