My idea is to change the position of the search bar, which is located in the center of the page in the upper right corner, when the user clicks or places the cursor in the search bar, thereby making an area in the center to show the search result.
Also, the cursor should remain in the search bar during the transition.
this is my html and css for search string
.search-container{
position: absolute;
width: 630px;
height: 100px;
z-index: 15;
top: 50%;
left: 37%;
margin: -100px 0 0 -140px;
}
.search-wrapper{
position: relative;
background-color: #b2dfdb;
width: auto;
height: 15em;
text-align: center;
border: 1px solid #fff;
box-shadow: 1px 1px rgba(0,0,0,0.35);
}
.searchbar-wrapper{
vertical-align: middle;
width: auto;
margin: 20px;
margin-top: 70px;
}
.search-bar{
float: left;
width: 400px;
line-height: 30px;
}
<div class="search-container" id="mainpage-search">
<div class="search-wrapper">
<div class="searchbar-wrapper">
<div class="row">
<div class="search">
<form class="form">
<div class="col-lg-8 col-md-8"><input class="search-bar" type="text" placeholder="Search for Songs"/></div>
<div class="col-lg-4 col-md-4"><span class="btn btn-blue btn-lg"><input type="submit" id="submit-query" value="Submit"></span></div>
<div class="clearfix"></div>
</form>
</div>
</div>
</div>
</div>
</div>
Run codeHide resultHow can I make the transition?
source
share