Unidentified spacing issue attributed to Bootstrap

Help needed right here! I'm working on styling this booking form to match my layout but encountering some pesky bugs that are proving difficult to fix.

During inspection of the submit button, I noticed a mysterious right margin that I can't seem to get rid of. The culprit may be related to a bootstrap grid, but all attempts to resolve it have been unsuccessful so far.

<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://kit.fontawesome.com/2dedfa30a2.js" crossorigin="anonymous"></script>
    </head>
    <body>
      <div id="booking">
        <div class="service-box">
          <button><i class="fas fa-plane-departure"></i>Tours</button>
          <button><i class="fas fa-car"></i>Rent a car</button>
        </div>
        <div class="booking-form">
          <form>
            <div class="row justify-content-center no-margin">
              <div class="col-md-2">
                <div class="form-header">
                  <span>Find Your</span><br>
                  <b>Destination</b>
                </div>
              </div>
              <div class="col-md-8">
                <div class="row no-margin">
                  <div class="col-md-4">
                    <div class="form-group">
                      <span class="form-label">Where to</span>
                      <input class="form-control" list="browsers" name="myBrowser" placeholder="Enter a country">
<datalist class="form-control" id="browsers">

      <option value="Spain">

      <option value="France">

      <option value="Italy">

      <option value="United States">
</datalist>
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                      <span class="form-label">From</span>
                      <input class="form-control" type="date">
                    </div>
                  </div>
                  <div class="col-md-4">
                    <div class="form-group">
                      <span class="form-label">To</span>
                      <input class="form-control" type="date">
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-2">
                <div class="form-btn">
                  <button class="submit-btn"><i class="fas fa-search"></i></button>
                </div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </body>
    </html>

... (remaining CSS styles)

Answer №1

The extra space is present because the submit button was placed within a parent element with a fixed width of col-md-2 (representing 2 out of 12 columns on the screen). To resolve this, you can remove the fixed column width and instead float the parent element to the right using justify-content-end.

<div class="row justify-content-end no-margin">
    ...
    <div class="">
        <div class="form-btn">
            <button class="submit-btn"><i class="fas fa-search" aria-hidden="true></i></button>
        </div>
    </div>
</div>

You can view the fully functional version on JSFiddle here: https://jsfiddle.net/6wk7bm40/

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

Arranging arrays in a MySQL gallery using PHP for optimal sorting

I've been attempting to organize my images from the database in a grid list format like this: ... I'm feeling stuck and unsure of what changes to make in my code. I really need some assistance, as I'm working on setting up an online store. ...

Align two grid columns in the centre of the footer

I have a question regarding the alignment of two grid columns in my footer. I am using Bootstrap 4 and would like to center them directly in the middle. Currently, both columns are centered individually but there is a large space between them. I have tried ...

Is it possible to create a hyperlink in the <button> element?

Having been immersed in HTML5 for quite a while now, I recently encountered a challenge while working on my login/register page project. I wanted to create a button that would redirect me to another HTML page upon clicking. While I am familiar with the < ...

The JQuery code is failing to remove the dynamically added field when the delete icon is clicked

Information: I am currently navigating the world of programming and attempting to build a To-Do List feature. When the create list button is clicked, a dynamically generated div with the class 'wrap' is created. This div contains two nested divs: ...

Create a login <div> that appears to float effortlessly on the screen

Seeking assistance in creating a login div similar to the one on ups.com. Upon clicking the login button on www.ups.com, a floating login div appears. How can I generate a similar div? Any help would be greatly appreciated. Thank you. ...

Hide button for the last input form to dynamically remove in jQuery

At first, I hide the remove button when there is only one form. However, if there are multiple forms and the user deletes all of them, I want the last form to remain visible and not be deleted. Can someone assist with this issue? Here is my code: <! ...

Is it possible to run quirks mode in one frame while running standards mode in another?

Back in the IE6 days, I developed an old application that relies on frames instead of iframes and runs in quirks mode. Now, I'm wondering if it's possible to have one frame remain in quirks mode while another operates in standards mode when using ...

Using Bootstrap4 to create dropdown menus within fixed table cells

I am currently utilizing Bootstrap 4 to construct a table with an action column housing a dropdown menu. My objective is for that specific column to remain fixed in place, ensuring it remains visible even when there is horizontal scrolling. The issue I am ...

Attempting to utilize the red, green, and blue functions in LESS CSS to extract RGB values and subsequently inject them into a gradient

Is there a way to extract individual r, g, b values from a hex code and then use them in a background gradient without dealing with rgb values separately? I attempted to utilize the red(@color), green(@color), blue(@color) functions but encountered an erro ...

What is the best way to implement gravity in order to make my character jump effectively

As a beginner in the world of coding, I am currently working on creating a game. However, one major challenge I am facing is simulating gravity to make my character jump effectively. Despite trying various methods, I have encountered disappointing results. ...

The Analog Clock is unable to access the property of null

I'm struggling to understand what's wrong here. The querySelector doesn't seem to be functioning correctly as I keep encountering the error "cannot read the property of null" on line 10 of my JavaScript code. const deg = 6; const hr = docum ...

Creating an image rollover effect when hovering between two images

I am currently working with React and trying to change 2 images by hovering over them. Here is what I have accomplished so far: Card.js <div className="image-wrapper"> <img src={sprites.front_default} className="image" a ...

Is the textarea's shape out of the ordinary?

Most textareas are typically rectangular or square in shape, similar to this: However, I am interested in having a custom-shaped textarea, like the example below: Is it feasible to achieve? ...

Incorporating a pre-existing component into a Vue.JS template through an onclick event: How can this

I'm trying to enhance my template by implementing a feature that allows me to add a component simply by clicking on a button. Let me give you a glimpse of what I have in mind: The component named Draggable.vue is the one I intend to incorporate upon c ...

Text displayed in two columns with a circular image positioned in the left column

https://i.sstatic.net/52mhN.jpgI am attempting to create a layout with two columns of text and a rounded image in the upper left corner of the left column. Here is what I have so far: <div class="photoside-left"> <img class="photo" src="http://v ...

Getting rid of a particular jQuery animation

I have been searching all over the site, but my limited knowledge prevented me from finding the right solution. I've been working on my website and had previously used a different theme. I have made several changes and am quite happy with it overall. ...

Designing a structure with three fieldset components

I'm currently trying to design a page layout that includes three fieldsets. My goal is to have the first one span across 100% of the width, with the other two positioned side by side below it at 50% width each. However, I am struggling to achieve thi ...

Utilize a combination of min-height percentages and pixels on a single div element

Currently searching for a method to explain min-height: 500px; min-height: 100%; the reason behind my decision to utilize this? The div must be either 100% in size or larger to allow for overflow. The height should only be set to 500px when the screen i ...

Reordering Bootstrap 4.1 columns for improved visibility on smaller screens

I'm having trouble adjusting the column order for small screen resolutions in Bootstrap 4.1. I've added the order prefix but nothing seems to be changing. Here is a snippet of my HTML code. Can anyone offer assistance? <div class="container-f ...

Is there a way to quickly add children to a div all at once?

I'm looking for a solution where an element is first replaced with a div, and then that div has some children added using append(): $(el).html('<div></div>').append('<span></span>').append('<span> ...