🔍 Search Input
Поля поиска с различными стилями
← Назад к Формы
С иконкой
HTML
<div class="search-input"> <span class="search-icon">🔍</span> <input type="search" class="search-field" placeholder="Search..."> </div>
CSS
.search-input {
position: relative;
width: 300px;
}
.search-icon {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
font-size: 1rem;
pointer-events: none;
}
.search-field {
width: 100%;
padding: 0.75rem 1rem 0.75rem 2.75rem;
border: 2px solid #e0e0e0;
border-radius: 8px;
font-size: 0.95rem;
outline: none;
transition: all 0.3s ease;
font-family: inherit;
}
.search-field:focus {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
Закруглённый
HTML
<div class="search-rounded"> <span class="search-rounded-icon">🔍</span> <input type="search" class="search-rounded-field" placeholder="Search..."> </div>
CSS
.search-rounded {
position: relative;
width: 300px;
}
.search-rounded-icon {
position: absolute;
left: 1.25rem;
top: 50%;
transform: translateY(-50%);
font-size: 1rem;
pointer-events: none;
}
.search-rounded-field {
width: 100%;
padding: 0.85rem 1.25rem 0.85rem 3rem;
border: none;
border-radius: 50px;
font-size: 0.95rem;
background: #f5f5f5;
outline: none;
transition: all 0.3s ease;
font-family: inherit;
}
.search-rounded-field:focus {
background: white;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}
С кнопкой
HTML
<div class="search-btn"> <span class="search-btn-icon">🔍</span> <input type="search" class="search-btn-field" placeholder="Search..."> <button class="search-btn-submit">Search</button> </div>
CSS
.search-btn {
position: relative;
display: flex;
width: 360px;
background: white;
border: 2px solid #e0e0e0;
border-radius: 8px;
overflow: hidden;
transition: all 0.3s ease;
}
.search-btn:focus-within {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.search-btn-icon {
position: absolute;
left: 1rem;
top: 50%;
transform: translateY(-50%);
font-size: 1rem;
pointer-events: none;
}
.search-btn-field {
flex: 1;
padding: 0.75rem 1rem 0.75rem 2.75rem;
border: none;
font-size: 0.95rem;
outline: none;
font-family: inherit;
}
.search-btn-submit {
padding: 0 1.5rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
font-family: inherit;
}
.search-btn-submit:hover {
opacity: 0.9;
}