The form includes Bootstrap columns and a button, but there is noticeable wasted space within the

This is the form structure I am working with:

<form method="GET" action=".">
        <div class="container-fluid pt-2 px-5 py-3">
            <div class="row g-4">
                <div class="col-sm-12 col-xl-6 py-xl-2">
                    <div class="bg-secondary rounded h-25 p-4">
                        <h6 class="mb-3">Symbol</h6>
                        <select name="symbol" class="form-select form-select-sm mb-3" aria-label=".form-select-sm example">
                            <option value="">All Symbols</option>
                            {% for sym in used_symbols %}
                            <option value={{sym}}>{{sym}}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="bg-secondary rounded h-25 p-4 mt-2">
                        <h6 class="mb-3">Side</h6>
                        <select name="side" class="form-select form-select-sm mb-3" aria-label=".form-select-sm example">
                            <option value="">All</option>
                            <option value='l'>Long</option>
                            <option value='s'>Short</option>
                        </select>
                    </div>
                    <div class="bg-secondary rounded h-25 p-4 mt-2">
                        <h6 class="mb-3">Status</h6>
                        <select name="status" class="form-select form-select-sm mb-3" aria-label=".form-select-sm example">
                            <option value="">All</option>
                            <option value='l'>Win</option>
                            <option value='s'>Loss</option>
                            <option value='s'>Draw</option>
                            <option value='s'>Open</option>
                        </select>
                    </div>
                </div>
                <div class="col-sm-12 col-xl-6 py-xl-2">
                    <div class="bg-secondary rounded h-25 p-4">
                        <h6 class="mb-4">Check, Radio & Switch</h6>
                    </div>
                    <div class="bg-secondary rounded h-25 p-4 mt-2">
                        <h6 class="mb-4">Check, Radio & Switch</h6>
                    </div>
                    <div class="bg-secondary rounded h-25 p-4 mt-2">
                        <h6 class="mb-4">Check, Radio & Switch</h6>
                    </div>
                </div>
            </div>
            <button type="submit" class="btn btn-primary">Search</button>
        </div>
        </div>
    </form>

The issue I'm facing is that there are unnecessary spaces between the submit button and my columns. I've attempted to adjust this using styling properties like height on the row or columns but haven't been successful.

I have yet to find a solution to eliminate these unwanted spaces...

Answer №1

It seems like the magic lies in the flex or grid. By specifying the align-items, you gain control over the height of the row. Let's hope for some insightful comments shedding light on this mystery.

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0f6d60607b7c7b7b47">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">


<form method="GET" action=".">
  <div class="container-fluid pt-2 px-5 py-3">
    <div class="row g-4" style="align-items: start">
      <div class="col-sm-12 col-xl-6 py-xl-2">
        <div class="bg-secondary rounded h-25 p-4">
          <h6 class="mb-3">Symbol</h6>
          <select name="symbol" class="form-select form-select-sm mb-3" aria-label=".form-select-sm example">
            <option value="">All Symbols</option>
            {% for sym in used_symbols %}
            <option value={{sym}}>{{sym}}</option>
            {% endfor %}
          </select>
        </div>
        <div class="bg-secondary rounded h-25 p-4 mt-2">
          <h6 class="mb-3">Side</h6>
          <select name="side" class="form-select form-select-sm mb-3" aria-label=".form-select-sm example">
            <option value="">All</option>
            <option value='l'>Long</option>
            <option value='s'>Short</option>
          </select>
        </div>
        <div class="bg-secondary rounded h-25 p-4 mt-2">
          <h6 class="mb-3">Status</h6>
          <select name="status" class="form-select form-select-sm mb-3" aria-label=".form-select-sm example">
            <option value="">All</option>
            <option value='l'>Win</option>
            <option value='s'>Loss</option>
            <option value='s'>Draw</option>
            <option value='s'>Open</option>
          </select>
        </div>
      </div>
      <div class="col-sm-12 col-xl-6 pt-xl-2">
        <div class="bg-secondary rounded h-25 p-4">
          <h6 class="mb-4">Check, Radio & Switch</h6>
        </div>
        <div class="bg-secondary rounded h-25 p-4 mt-2">
          <h6 class="mb-4">Check, Radio & Switch</h6>
        </div>
        <div class="bg-secondary rounded h-25 p-4 mt-2">
          <h6 class="mb-4">Check, Radio & Switch</h6>
        </div>
      </div>
      <button type="submit" class="btn btn-primary">Search</button>
    </div>
  </div>
</form>

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

Opacity in text shadow effect using CSS

Within my text lies the following css snippet: .text-description-header { font-size: 250%; color: white; text-shadow: 0 1px 0 black; } Observe the dark shadow effect it possesses. Inquiry I am curious if there is a way to alter the shadow t ...

Limit Content to be contained within a Bootstrap Container/Div

How can I shrink the content inside a container without distorting images? When the screen size decreases, all the images and content inside start to lose their alignment and sizes begin to change. I am aware that this may make the content harder to see. ...

Setting a page title using PHP based on a conditional statement can be achieved by

I am attempting to display a different title for each page In the header.php file, I am checking the file name to set the correct title like this <?php $page = basename($_SERVER['PHP_SELF']); if ($page == 'index.php'): ?> <ti ...

When I apply properties in JavaScript, I find that I am unable to utilize the CSS "hover" feature

For a personal project I am currently working on, I decided to experiment with setting background colors using Javascript. However, I have encountered an issue where my CSS code that changes the hover property does not seem to work after implementing the J ...

Adjust the transparency level of the image's mapped area

I need help with changing the opacity of a specific area on an image map when clicked. The image has three areas, but I only want to target and change the opacity of the test2 area regardless of which area is clicked. Since my knowledge of jQuery syntax is ...

Disconnect the parent when the child is clicked in CSS

I am struggling to find a solution for this issue. Currently, I have a hover effect where when I click on a submenu li item, the parent li also gets highlighted. You can see the behavior in the image below: https://i.sstatic.net/Ie6Lb.png Is there any w ...

Creating a Circular Design with a Centered Line and Text Above and Below using Qualtrics (HTML/CSS/Java)

My knowledge of creating shapes and using these programming languages is limited. I am currently working on a survey in Qualtrics and I need to insert text into circular shapes. Creating one circle was straightforward, thanks to some helpful discussions ...

Concealing a message within a section that has been minimized to a width of 0

Recently, I've encountered a challenge in attempting to set the width of a section to 0 and have all its contents also disappear. Despite changing the section's width to 0px, the text inside continues to be displayed and even shifts off to the si ...

The Scottish flag isn't displaying on my website, but all other Emoji 5 symbols are working perfectly

When I build my website with PHP, I include header('Content-Type:text/html; charset=utf-8'); at the start. Interestingly, the Scottish flag emoji ...

How to display and download a PDF file on a JSP web page

Can anyone help me with a simple trick to solve this question I have? In my project folder, I have 5 PDF files named file1.pdf, file2.pdf, file3.pdf, file4.pdf, and file5.pdf. I want to display these files in 5 rows on my webpage, each row containing VIEW ...

Ensure that PHP form validations are checked when submitting the form using jQuery

I have created a form in HTML with basic verification. Here is the code: <form class="" action="submit/save" method="POST" enctype="multipart/form-data" id="submit_form"> <input class="form- ...

Python Selenium not registering button click

I'm working on scraping data from the website using Python with Selenium and BeautifulSoup. This is the code I have: driver = webdriver.Chrome('my file path') driver.get('https://www.ilcollege2career.com/#/') first_click = Web ...

Experience the magic of Materialize CSS SideNav

I'm currently attempting to implement the mobile side navigation provided by Materialize. I've managed to display the menu icon, but when I click on it, nothing happens. It seems like the function is not being triggered, and there are no errors s ...

Formatting that differs based on whether the content appears on the left

I'm in search of a solution to align specific items to the left on left-hand pages and to the right on right-hand pages. I have come across @page :left/:right, but it seems to only affect the page layout and margins, not the actual content on the page ...

I'm having trouble making the colors change on my Icon font/sprite rollover

I am currently attempting to position some related icons above my main navigation menu. The goal is to change the text and icon colors when a user hovers over a specific area (the tag with large padding). Unfortunately, I am facing challenges in achieving ...

Splitting areas within a liquid vessel using bootstrap 5

My container is structured like this with divisions: <div class="container-fluid"> <div class="row"> <div class="col-3"> sidebar </div> <div class="col-7"> top slider </div> <di ...

Tips on invoking a factory method from a different service method in AngularJS

I have a factory method that goes like this.. (function (angular) { "use strict"; angular .module('app') .factory('UserService', ['$rootScope', '$q', function ($rootScope, $q) { ...

What is the best way to format an image within an <a> element?

Below is a code snippet that includes a tags, with one containing an image. <div class="container"> <a href="#">Not styled</a> <a href="#"><img src="image.png"></a> </div> If I specifically want to style ...

The method models.User.fromURI is unsuccessful

When I try to call models.User.fromURI as shown below: models.User.fromURI("spotify:user:" + user, function (user) { $(div).html("<b ><a style=\"color:#FFFFFF\" href=\"spotify:user:" + user.username + "\">" + us ...

Unleashing the Power of Wildcards in HTML with XPath

When using XPath to extract values from DOM elements, I've encountered inconsistent XPaths. To select all DOM elements on the same level, I've resorted to some wildcard magic. For instance, in an HTML document, my XPaths may look like: //div[@i ...