I have created a search bar with a filter to provide accurate search results. The filter includes three values: areaUnit, area, and price. However, the current layout is not user-friendly as it disrupts the position of elements on the page. I would like the filter div to behave like a dropdown menu, smoothly sliding down when needed. Here is my attempt at implementing this functionality:
<form>
<div class="wrap">
<div class="search">
<input type="text" class="searchTerm" style="width: 700px; color:#000000; text-align: left;" placeholder="Search Houses" onclick="filterfunction()">
<button type="submit" class="searchButton" >
<i class="fa fa-search"></i>
</button>
</div>
<div id="filter" style="display:none; background-color:#D3D3D3;border:1px; border-style:solid; border-color:black; border-radius:5px">
<label for="price"style=" margin-left:75px;border:none" >Area Unit</label>
<label for="price"style=" margin-left:30px;border:none " >Area</label>
<label for="price" style=" margin-left:70px;border:none">Price</label>
<div>
<select asp-for="Input.areaunit" style="height :50px; border-style:solid ;border-color: black;border-radius:5px; margin-left:100px;">
<option value="" hidden>Select area Unit</option>
<option value="Kanal">Kanal</option>
<option value="Marla">Marla</option>
<option value="Square Feet">Square Feet</option>
<option value="Square Meter">Square Meter</option>
<option value="Square Yards">Square Yards</option>
</select>
<input list="Input.area.list"asp-for="Input.area" placeholder="Please Select area" style="height :50px; border-style:solid ;border-color: black;border-radius:5px; margin-left:20px;">
<datalist id="Input.area.list">
<option value="10"></option>
<option value="12"></option>
<option value="15"></option>
<option value="20"></option>
<option value="25"></option>
<option value="30"></option>
<option value="35"></option>
</datalist>
<input type="hidden" name="Input.price" id="Input.price"asp-for="Input.price" />
<!-- Hidden field above-->
<input list="Input.price.list" id="rsInput" placeholder="Please Select price" style="height :50px; border-style:solid ;border-color: black;border-radius:5px; margin-left:20px;">
<datalist id="Input.price.list">
<option value="5,00,000"></option>
<option value="10,00,000"></option>
<option value="15,00,000"></option>
<option value="20,00,000"></option>
<option value="25,00,000"></option>
<option value="30,00,000"></option>
<option value="35,00,000"></option>
<option value="40,00,000"></option>
<option value="45,00,000"></option>
</datalist>
</div>
</div>
</div>
</form>
Check out the view below: