Имитировать форму поиска
Не могу имитировать форму поиска. То-есть визуально это должно отображаться как форма поиска "Search" но при клике на нее пользователь переходит на страницу (соответственно урл страницы прописывается в коде). Нужно чтобы:
- Отображалась надпись "Поиск по сайту;
- Отображалось изображение "лупа";
- Сама форма как ссылка на страницу;
Повторяюсь это имитация поиска, визуально это форма поиска в ней НЕ должен набираться текст. Просто при нажатии переход на станицу. То-есть пользователь видит и думает, что это форма поиска, но по факту это ссылка. Кого не затруднит накидайте плиз код и CSS. Очень буду благодарен
Ответы (1 шт):
Автор решения: Denis640Kb
→ Ссылка
Вы можете просто взять абсолютно любую форму поиска и наложить на неё через display:absolute свою ссылку.
Вот как пример:
@import url("https://fonts.googleapis.com/css?family=Lexend+Deca|Dosis&display=swap");
body {
margin: 0;
padding: 16px;
flex: 1;
background: #d86f06;
justify-content: center;
align-items: center;
font-family: 'Lexend Deca', sans-serif;
overflow-Y: none !important;
}
button img {
transition: transform .25s;
}
button:hover > img {
transform: scale(1.2);
}
button:focus {
outline: none;
}
input {
font-family: 'Lexend Deca', sans-serif;
}
input::placeholder {
font-family: 'Lexend Deca', sans-serif;
}
input:focus {
outline: none;
}
.href {
position: absolute;
text-align: center;
width: 100%;
margin-top: -3%;
height: 30%;
}
.searchbox {
height: 60px;
width: 450px;
max-width: 100%;
background: white;
border-radius: 10px;
position: relative;
left: 0;
right: 0;
margin: 0 auto;
top: 50px;
display: flex;
}
.searchbox > .btn-menu {
padding: 16px;
background: transparent;
border: none;
cursor: pointer;
}
.searchbox > .search {
border: none;
width: 100%;
}
.searchbox > .btn-search {
padding: 16px;
background: transparent;
border: none;
cursor: pointer;
}
.search-modal-header h3 {
font-size: 16px;
text-transform: uppercase;
font-weight: 500;
float: left;
}
.search-modal-header span img {
float: right;
position: absolute;
right: 16px;
top: 25px;
margin: 0 auto;
cursor: pointer;
transition: .5s all;
}
.search-modal-header span img:hover {
transform: scale(1.1);
}
.search-modal-body .message {
display: flex;
cursor: pointer;
padding: 10px 15px;
border-radius: 10px;
}
.search-modal-body .message-avatar {
margin-right: 16px;
margin-top: 10px;
}
.search-modal-body .message-avatar img {
height: 60px;
width: 60px;
border-radius: 30px;
object-fit: cover;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.45);
}
.search-modal-body .message-body {
margin-left: 0;
margin-top: 8px;
}
.search-modal-body .message-body p {
margin-bottom: 0;
font-size: 14px;
font-weight: 500;
color: #444;
}
.search-modal-body .message-body small {
font-weight: 400;
font-family: Dosis;
color: #777;
}
.search-modal-body .message:hover {
background-color: #2F94D817;
}
@keyframes slideInUp {
from {
-webkit-transform: translate3d(0, 15%, 0);
transform: translate3d(0, 15%, 0);
visibility: visible;
}
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
<div class="searchbox">
<button class="btn-menu">
</button>
<input id="search" type="text" placeholder="Поиск по сайту" name="search" class="search">
<button class="btn-search">
<img src="https://img.icons8.com/cotton/24/000000/search--v2.png">
</button>
</div>
<a href="https://google.com" class="href"></a>