I'm currently focusing on the frontend development of an app where search functionality is paramount for user interaction. In light of this, I am considering placing the search feature at the bottom of the screen so that it can be easily accessed with just a thumb swipe.
The UI design I have envisioned is visually appealing and meets all my requirements; however, I'm facing a challenge in translating this design into reality using HTML and CSS. Below is a snapshot of how the design looks:
https://i.sstatic.net/aWmj9.png
My goal is to expand the search box located at the bottom of the page when the input field is focused, causing it to take up the entire screen while smoothly moving other elements to the top in an animated manner. How can I achieve this effect using HTML and CSS?
I've created a CodePen showcasing the initial state of the project and a partial implementation of the desired second state. Here's the code snippet:
HTML
<div class="search">
<h1 class="search__heading">Search</h1>
<input type="text" placeholder="type name" class="search__input" />
<ul class="search_recents">
<li class="search_recent-item">
<img class="search_recent-image" src="https://placehold.it/60x60" alt="person image" />
</li>
<li class="search_recent-item">
<img class="search_recent-image" src="https://placehold.it/60x60" alt="person image" />
</li>
</ul>
</div>
SCSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-size: 16px;
border: none;
}
ul,ol {
list-style: none;
}
html,body {
height: 100%;
}
body {
background: #5B5847;
}
.search {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #7B796B;
padding: 1.25em;
margin: 0 1.25em 1.25em 1.25em;
border-radius: 10px;
&:focus-within {
position: static;
margin: 0;
border-radius: 0;
height: 100%;
}
}
.search__heading {
font-size: 1.5rem;
margin: 0 0 1em 0;
font-family: arial, sans-serif;
}
.search__input {
width: 100%;
padding: 1.25em;
border-radius: 10px;
font-size: 1rem;
margin: 0 0 1em 0;
}
.search_recents {
display: flex;
}
.search_recent-item {
margin: 0 1em 0 0;
}
.search_recent-image {
border-radius: 50%;
}
Is there a way to toggle the visibility of the arrow icon?