Is there a way to align input-groups with form-groups in Bootstrap 3?

I have searched extensively on Google and SO but I can't seem to find a solution to this issue.

The problem I'm encountering is aligning an input-group with all the other form-groups. Every time I use an input-group, it adds some padding to it.

I have tried various solutions suggested here:

padding:0px !important;
margin:0px !important;
float: left !important;

However, none of them seem to work!

Code:

<div class="col-md-6">
                <div class="form-group">
                    <input id="est_mileage" name="est_mileage" type="text" placeholder="Estimated Mileage" autocomplete="off" class="form-control input-md"/>
                </div>
                <!--Padding Issue is Here-->
                <div class="input-group" style="padding:0px !important; margin:0px !important; float:left; width:100%;">
                  <span class="input-group-addon" style="width: 45px;">
                    <input value="1" type="checkbox" id="combinedSelector" name="one_off" />
                  </span>
                <input id="acc_mileage" name="acc_mileage" type="text" placeholder="Actual Mileage" autocomplete="off" class="form-control"/>
                </div>
                <!--End Issue-->
                <div class="form-group">
                    <input id="fuel" name="fuel" type="text" placeholder="Fuel(ltrs)" autocomplete="off" class="form-control input-md"/>
                </div>
                <div class="form-group">
                    <input id="price" name="price" type="text" placeholder="Price" autocomplete="off" class="form-control input-md" />
                </div>
                <div class="form-group">
                    <input id="cwt_dwt" name="cwt_dwt" type="text" placeholder="CWT & DWT" autocomplete="off" class="form-control input-md" />
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <input id="def_ser_num" name="def_ser_num" type="text" placeholder="Defect Serial Number" autocomplete="off" class="form-control input-md" />
                </div>
                <div class="form-group">
                    <input required id="product_volume" name="product_volume" type="text" placeholder="Product Volume" autocomplete="off" class="form-control input-md" />
                </div>
                <div class="form-group">
                    <input id="ref_po" name="ref_po" type="text" placeholder="Ref/PO" autocomplete="off" class="form-control input-md" />
                </div>
                <div class="form-group">
                    <input id="comments" name="comments" type="text" placeholder="Job Specifics" autocomplete="off" class="form-control input-md" />
                </div>
                <div class="form-group">
                    <input id="billing_com" name="billing_com" type="text" placeholder="Billing Info" autocomplete="off" class="form-control input-md" />
                </div>
                <div class="form-group">
                    <input id="iss_rep" name="iss_rep" type="text" placeholder="Issues/Repairs" autocomplete="off" class="form-control input-md" />
                </div>
            </div>

This form is within a collapse div and is displayed in a modal view.

See the result: https://i.sstatic.net/QwRtf.png

Answer №1

To achieve consistency with other form groups, remember to include the form-group class inside the div that also has the input-group class. Additionally, it's important to remove any inline styles like

padding:0px !important; margin:0px !important; float:left;

This adjustment will ensure uniformity across all form groups.

View Demo Here

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

Error - IO Is Not Defined in Socket.io

Currently, I am developing a real-time chat web page. Initially, I was considering using PHP, but I am experimenting with socket.io for the backend. However, I have encountered an issue where the browser console displays Uncaught ReferenceError: io is not ...

Using JQuery to swap out background images in CSS

I have been working on a slider that is supposed to fade one picture over another. The issue is that the background change seems to only work in the Dreamweaver preview and not in the actual browser. loop = setInterval(function(){ $("#slider").css("ba ...

Is it possible for me to send JSON data using a form to HTTP_RAW_POST_DATA?

Currently, I am in the process of creating a web interface for code that is typically designed to run on Android devices. I transmit JSON data and retrieve the data by using the following method: $json = json_decode($HTTP_RAW_POST_DATA,true); Is there a ...

Tips for aligning the child elements of a dropdown menu to stick with the parent's top position

It's important that progress and my goals are clearly outlined here: View my CodePen When it comes to the "Offices" section, I need the child objects to display directly below and ideally match the width of the parent element. Here is the code snip ...

Make a button gradually disappear after being clicked using jQuery

Recently delving into the realm of jQuery, I've encountered a stumbling block with this particular code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button class="add">Add</button> ...

"Get a sneak peek of your page before hitting submit with this HTML

Is it possible to create a pop-up page preview in just one button click on my current HTML page? I would like to only use the Body Elements from the current page and Header Elements from other resources. My inquiry is: Can the header (<head>) eleme ...

Utilizing Google Maps API to dynamically input destinations in text boxes

Check out my code at this link: I apologize for the inconvenience, but I had some difficulty pasting it directly into this forum. The code is functioning well, however, I need assistance with a particular issue. Currently, the textboxes for start and des ...

Having issues with the horizontal list layout

I am having trouble implementing Bootstrap horizontal lists on my website. How can I resolve this issue? Desired outcome: https://i.sstatic.net/zzBFi.png Current situation: https://i.sstatic.net/cfoZN.png Below is the snippet of CSS code in question ...

Fixing a scrolling element within a div located below the screen is my goal, ensuring it remains fixed in place as the user scrolls

I'm facing a challenge that I need help with: My HTML/CSS layout currently looks like this: Screenshot of how my CSS/HTML appears on the screen upon page load: As I scroll down, I encounter a green element: While scrolling down -> Upon further s ...

When leaving the page, onBeforeUnload function aborts any ongoing HTTP requests

When attempting to send an http request using the fetch API upon leaving the page, I am encountering a blockage of the request. Is there a solution to this issue without resorting to using an async function or waiting for the request to complete, which tri ...

What is the best way to transfer form input data from a child component to the parent component in React?

Recently delving into the world of React, I decided to experiment with forms. My project idea was straightforward - create a form component with input fields that, upon clicking submit, would pass the input values to the parent component ('App') ...

The reason the section's height is set to 0 is due to the absolute positioning of the div

Currently, I have a section tag with three divs inside that are positioned absolute (used for the isotope plugin). <section id="section1" class="cd-section"> // pos. static/relative has height 0px <div class="itemIso"> // pos. absolute, he ...

Display an array of objects using React within the columns of a Bootstrap grid

I am facing a challenge where I have an array of components that I need to render in separate cells. The number of elements in the array can vary, sometimes exceeding the limit of 12 cells in the Bootstrap grid system. In such cases, I need to create new r ...

Is there a way to maintain consistent height among vertical divs?

Is it possible to create a ranking system that adjusts based on the user's points while maintaining consistent height with an image? How can I eliminate the br tags in this scenario? <!DOCTYPE html> <html lang="en>" <head> <m ...

I prefer to avoid generating the document structure while parsing with JSOUP

Utilizing the Jsoup API to parse a section of HTML using the Jsoup.parse() method. However, during parsing, it includes the document structure in the HTML content. For Instance: <p><a href="some link">some link data</a> Some paragraph c ...

Embed the image within the form input

I am trying to incorporate an SVG image into a bootstrap form input, similar to this example: https://i.sstatic.net/7ZSRH.png This is the HTML code: <div class="col-md-6"> <div class="subscribe-wrapper subscribe2-wrapper mb-15&q ...

Play a matching game using CSS3 to match and check tiles

Currently in the process of creating a game using HTML5 and CSS3. I'm working with several divs that have hover-activated CSS3 animations. The game itself is a simple matching tiles/cars game, optimized for Chrome as it currently only supports -webki ...

What is the purpose of using multiple css classes together?

In my project, I have implemented CSS modules which allow me to use multiple classes. The variable open is a boolean that determines whether or not the Paper should shift. <Paper className={`${classes.paper} ${open && classes.paperShift}`}> Questio ...

Switch Image to Background Image on Mobile Devices

I am currently working on a website that needs a special page for an upcoming event. Typically, the pages on this site have a mast banner image that stretches across the full width of the page. However, for this particular page, it is necessary for the ima ...

What is the best way to ensure smooth and consistent tabs using CSS?

After implementing a UI with 4 tabs, I noticed that the gap between the tabs is inconsistent. When attempting to set the width to auto, the indicator below the tabs does not display properly. Here is the code for the tabs: <div class="MuiTabs-flex ...