Enhance the aesthetic appeal of the Search and Filters component in ASP.NET Core using Bootstrap styling

I am struggling to enhance the style and layout of multiple search filters on the page so that the User Experience is improved. I'm unsure how to effectively design this search component.

<section class="search-sec">
 <div class="container">
    <form asp-action="Index" method="get">
        <div class="row">
            <div class="col-lg-12">
                <div class="row">
                    <div class="col-lg-3 col-md-2 col-sm-12 p-0">
                        <input class="" type="text" name="name" placeholder="Name" value="@ViewData["name"]" />
                    </div>
                    <div class="col-lg-2 col-md-2 col-sm-12 p-0">
                            <label for="age" class="">Age</label>
                            <select class="" name="age">
                                ........
                    </div>
                    <div class="col-lg-3 col-md-3 col-sm-12 p-0">
                        <label for="minAge">Age range between</label>
                        <select name="minAge">
                         ......
                        </select>
                        and
                        <select name="maxAge">
                           ......
                        </select>
                    </div>
                    <div class="col-lg-3 col-md-3 col-sm-12 p-0">
                        <label for="sex">Sex</label>
                        <select name="sex">
                            .....
                        </select>
                    </div>
                    <div class="col-lg-3 col-md-3 col-sm-12 p-0">
                        <label for="stockNumber">Find by Stock Number</label>
                        <input type="text" name="stockNumber" value="@ViewData["stockNumber"]" 
                    </div>
                    <div class="col-lg-3 col-md-3 col-sm-12 p-0">
                        <input type="submit" value="Search" class="btn btn-default" /> |
                        <a class="btn btn-link" asp-action="Index">Clear</a>
                    </div>
                    </div>
                </div>
            </div>
       </form>
     </div>
    </section>

Despite adjusting sizes, the issue remains and the search functionality appears like this

https://i.stack.imgur.com/bCPJm.png

I have searched for Bootstrap examples but haven't found a solution. Can someone provide suggestions on improving the appearance of this search feature? Any assistance would be much appreciated.

Answer №1

In order to align the grid system with 12 columns in a single line, you need to ensure that the sum of * in col-lg-* equals 12. Additionally, consider adjusting the text length to prevent overflow outside the div width.

Check out this functional demo:

<section class="search-sec">
    <div class="container-fluid">
        <form asp-action="Index" method="get">
            <div class="row">
                <div class="col-lg-12">
                    <div class="row">
                        <div class="col-lg-1 col-md-2 col-sm-12 p-0">
                            <input class="" type="text" name="name" placeholder="Name" value="@ViewData["name"]" />
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-12">
                            <label for="age" class="">Age</label>
                            <select class="" name="age">
                                <option>- Any -</option>
                                <option>aaa</option>
                                <option>bbb</option>
                                <option>ccc</option>
                            </select>
                        </div>
                       <!-- More code here -->
                    </div>
                </div>
            </div>
        </form>
    </div>
</section>
@section Scripts
{
<style>
    input[type="text"] {
        width: 100%;   // Ensure fit within div width
    }
    select {
        width: 65px;
    }
</style>
}

Result:

https://i.stack.imgur.com/uaJ09.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The outcome when submitting an HTML survey

I have a curiosity about what really happens when you click the submit button on an HTML survey like the one displayed below: <INPUT TYPE="radio" NAME="bev" VALUE="no" CHECKED>No beverage<BR> <INPUT TYPE="radio" NAME="bev" VALUE="tea">Te ...

Having trouble centering the links in the Bootstrap navbar?

I've been struggling to center the links/tabs on my Bootstrap navbar for days now and I just can't seem to get it right. I've gone through countless similar questions without any luck. Something must be off in my code or maybe I'm not t ...

Scripting method to transfer multiple subdirectories using a cpanel.yml file (excluding the use of the wildcard)

I have been referring to the documentation found at My current issue is that when I try to copy my subfolders, it doesn't work properly unless I use a workaround. The only way I am able to achieve the desired outcome is by utilizing the following co ...

Revamp the button's visual presentation when it is in an active state

Currently, I'm facing a challenge with altering the visual appearance of a button. Specifically, I want to make it resemble an arrow protruding from it, indicating that it is the active button. The button in question is enclosed within a card componen ...

Adjusting the input label to be aligned inside the input box and positioned to the right side

I am currently working on aligning my input label inside the input box and positioning it to float right. The input boxes I am using have been extended from b4. Currently, this is how it appears (see arrow for desired alignment): https://i.stack.imgur.co ...

What is the best way to merge two JSON values with the help of jQuery?

Two JSON Objects are provided below: The first one is: [{ "id": 5001, "count": "0", "type": "None" }, { "id": 5002, "count": "0", "type": "Glazed" }, { "id": 5005, "count": "0", "type": "Sugar" }, { "id": 5003, ...

My JavaScript functions are not compliant with the HTML5 required tag

I am currently developing input fields using javascript/jQuery, but I am facing an issue with the required attribute not functioning as expected. The form keeps submitting without displaying any message about the unfilled input field. I also use Bootstrap ...

How can I customize the styling of Autocomplete chips in MUI ReactJS?

Trying to customize the color of the MUI Autocomplete component based on specific conditions, but struggling to find a solution. Any ideas? https://i.stack.imgur.com/50Ppk.png ...

I'm wondering if anyone has any insights as to why the CSS rule `body{ overflow: auto;}` is not functioning properly for me. Despite my attempts of adding a class to the body tag and

I am facing an issue where adding body tags to my code in Visual Studio code does not yield the desired results. Interestingly, it doesn't seem to be a syntax error in CSS. body{ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI&apo ...

Convert JSON data from jQuery into a modal form within a div element

I am currently working on an MVC application and attempting to populate a bootstrap modal form with data from the server. My approach involves: 1) Loading a grid with various IDs, each linked to a javascript onclick function. 2) The function retrieves th ...

What is the best way to attach a value to an attribute of a web component in Angular?

In all honesty, I am quite new to Angular and still learning the ropes. Currently, I am faced with a debugging challenge related to one of the users encountering an issue with my web component library. Within this library, there is a custom element create ...

Proper method for posting an object array through a form submission

I am currently integrating a payment service API into my application and following the instructions provided on their website. The documentation specifies that the POST body should have the following structure: api_hash=38be425a-63d0-4c46-8733-3e9ff662d62 ...

A distinctive noise is heard when hovering over multiple instances of a div

I'm trying to implement a feature where a unique sound plays when hovering over a specific div element with a particular class (.trigger). However, I am encountering an issue where multiple instances of this div class result in the same sound being pl ...

Discover the steps to linking a dropdown menu to a text input using HTML and JavaScript

I'm currently using Sublime and trying to link a dropdown menu with an input text using html, css, and javascript. When the user selects an option from the dropdown menu, I want the corresponding value to appear in the text input field. For example, i ...

What is the process for creating URL query parameters?

What is the process for generating parameters after node?_=xxxxxx? If I am using a Python script to access the URL, how can I retrieve these parameters? edit: I apologize for not providing enough information. This is my first post as a novice. I am atte ...

"Is it possible to draw on top of a canvas element that's already been

I'm currently working with an OpenLayers map that includes WMS layers with time steps. My goal is to create a loop that updates the time for each step and then saves the image once it's rendered. I've been referencing the example code from t ...

The options for answering (True, False, Yes, and No) are not currently visible

I am struggling with displaying buttons for "True", "False", "Yes", and "No" in an appended row. Here is the application: Application To use the application, follow these steps: 1. Open the application and click on the green plus button. A modal window ...

Choosing elements in jQuery

Having some trouble with the subnav on my current website project. I think the issue lies in how I am selecting items in my jquery code. It seems like a small fix that needs to be made, but I'm unsure of the correct approach. http://jsfiddle.net/ZDEr ...

Setting up a custom PrimeNG theme to match our unique style is a great way to

I am currently using the most recent version of "primeng": "^12.2.0", and I am looking to implement my own custom theme for primeng. Despite searching through numerous blogs, I have yet to find a solution. In an attempt to create my cu ...

The Challenge with jQuery Nano Scroll

I recently added the jQuery Nano Scroll plugin to my HTML page. However, I am facing an issue where the scrollpane is not visible. When I inspect the div using Chrome, the scrollpane appears. Any suggestions on how to resolve this? Here's a snippet ...