The Bootstrap width is spilling over and not conforming to the content of the form

I'm facing an issue with content overflow on multiple forms within a webpage that uses Bootstrap 4. I can't seem to find a solution to make the width of the forms fit the content properly. Take a look at this picture showing one of the simpler forms, and another image here showcasing other forms for reference. Below is a snippet of my code:

In page.html:

<div class="admin_section">
    <h3>Removals</h3>

    <div class="admin_section_content container">
        <form method="post">
            <div class="form-group row">
                <label for="deleteName" class="col-sm-2 col-form-label">Remove a Menu Item</label>
                <div class="col-sm-2">
                    <input type="text" name="remove_item_name" pattern="^[a-zA-ZÀ-ÿ-' ]+$" maxlength="25"
                        class="form-control" id="deleteName" placeholder="Food Item Name" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="removeItem" class="col-sm-2 col-form-label"></label>
                <div class="col-sm-2 text-right">
                    <button type="submit" class="btn btn-danger" id="removeItem" name="remove_item_button"
                        value="clicked">Remove Item</button>
                </div>
            </div>
        </form>

        <br><br>

        <form method="post">
            <div class="form-group row">
                <label for="deleteReceipt" class="col-sm-2 col-form-label">Refund a Receipt</label>
                <div class="col-sm-2">
                    <input type="text" name="remove_receipt_number" pattern="^\d{10}$" minlength="10" maxlength="10"
                        class="form-control" id="deleteReceipt" placeholder="Receipt Number" required>
                </div>
            </div>

            <div class="form-group row">
                <label for="removeReceipt" class="col-sm-2 col-form-label"></label>
                <div class="col-sm-2 text-right">
                    <button type="submit" class="btn btn-danger" id="removeReceipt" name="remove_receipt_button"
                        value="clicked">Refund Receipt</button>
                </div>
            </div>
        </form>
    </div>
</div>

In general.css:


.admin_section{
    margin-bottom: 1.5rem;
    margin-left: 35%;
    margin-right: auto;
}

.admin_section_content{
    font-family: 'Segoe UI', 'Open Sans', 'Helvetica Neue', sans-serif;
    margin-left: 2rem;
}

select{
    border-color: var(--bootstrap-grey);
    border-radius: 5px;
}

form{
    background-color: var(--form-grey);
    border-radius: 5px;
    padding: 15px;
}

body{
    overflow-x: hidden;
}

Answer №1

Yariel, your unconventional approach to experimenting with form placement in a column structure is truly refreshing and thought-provoking. I am excited to witness the outcomes of your trial.

<div class="col-sm-12 col-md-6">
        <form method="post">
            <div class="form-group row">
                <label for="deleteName" class="col-sm-2 col-form-label">Remove a Menu Item</label>
                <div class="col-sm-2">
                    <input type="text" name="remove_item_name" pattern="^[a-zA-ZÀ-ÿ-' ]+$" maxlength="25"
                        class="form-control" id="deleteName" placeholder="Food Item Name" required>
                </div>
           ...

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

Issues with the Bootstrap Nav Bar Megamenu dropdown functionality

I have coded my navbar, but the dropdown menu is not showing when I click on "For Techies." There are no error messages, so I'm not sure what the problem might be. Can someone please help me troubleshoot this issue? <button class="navbar-tog ...

Utilizing JavaScript to target a specific div element and modify the href attribute

I am currently working on adjusting the links within my page using JavaScript. While I am able to select the div and the a element, I am encountering difficulties in changing the href attribute. Shopify utilizes a for loop to generate these objects, and i ...

The variable in Vue.js is failing to update, resulting in a "variable is not defined" error

I've been attempting to display the updated value of the totalQuestions variable in the HTML, but I keep encountering the following error. Can someone point out where I went wrong? https://i.sstatic.net/mEEMS.jpg HTML <label><span class="r ...

Convert SQL data into an HTML table using ASP

I have a database with an unknown number of rows containing columns for id and text. In my code, I am converting this data into a list of objects named news with parameters id and text. HTML <div class="middleDiv" id="mid" runat="server"> </div& ...

Style your toolbar the Google way with CSS and HTML

Trying to replicate the Google-style toolbar found on G-mail and other Google services has been a challenge for me. I have experimented with creating this toolbar using a formatted list and nested div elements within a single container, but I encounter th ...

What are some creative ways to animate a highlight effect on a CSS

I'm struggling to implement a sliding underline effect for my top navigation bar on hover. I've tried using transitions and keyframes, but so far it's not working as expected. My current attempt only triggers the effect on the parent elemen ...

Prevent the occurrence of a page break in between dt and dd elements

There are multiple instances of <dd> and <dt> elements in a specific order on this page. For instance: <dt> "Here is some random text" </dt> <dd> <input type="text"> <span></span> </dd> This str ...

Tips on avoiding tags from causing line breaks?

My dilemma involves a collection of tags that I prefer not to be subject to word-wrap, but I do want the list of tags to wrap appropriately. For instance: [first] [second thing] [yet another thing] What I definitely do not want is: [first] [second thi ...

Could you please show me a demonstration of how to add text animation dynamically to a Div element?

I am interested in creating a text animation using JQuery, but I am unsure of how to start and actually code it. Where should I begin or what can/should I search for on Google? If you take a look at , you will notice the moving text and the seamless way t ...

Exploring ways to personalize the behavior and style of the material-ui Accordion component

There is a div container in gray with an accordion component containing only one AccordionSummary component. Below that is another div in blue. The initial view looks good (see pic #1). When the accordion is expanded: The AccordionDetails component is dis ...

Limit the Number of Elements in a Div Container for First-In-First-Out Data Streaming

Let's say you're in a situation where data is constantly being streamed in rows to be displayed inside a container. For each row of incoming data, you dynamically create a new element and add it to the container. However, you want to limit the ...

A picture resting on the left side of the text

I'm struggling to align images to the left of text within a div. When the screen is smaller than 768px, I want the images to stack on the left side of the text, with a maximum width of 150px. I've tried using float: left and adjusting the displa ...

Presentation: Troubleshooting Ineffective CSS3 Transitions

I have created a basic slideshow that can accommodate multiple images. Clicking on an image should move to the next slide, and once the last image is clicked, it should loop back to the first slide. The functionality of transitioning between slides seems ...

Enhancing the Alignment of a Bootstrap Navbar with CSS

Having trouble centering the listed items (excluding the image and title) in the middle of the navbar. Tried various solutions with no luck! Any suggestions on how to tackle this issue? <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a ...

Aligning HTML form with CSS styling

After researching various strategies on how to achieve this, and implementing the suggestions provided, I am still encountering difficulties. While the text successfully centers, the actual elements remain aligned to the left of the screen. Below is the f ...

Creating an HTML form that submits data to a PHP script, which then saves the

Looking for some assistance with a PHP issue I am having. I know my way around PHP, but I wouldn't say I'm an expert. Here's the problem: I have created an HTML form (form.html) and now I want the output from formular.php to be saved as a u ...

What is the reason behind the success of this location?

Curious about the functionality of this particular JavaScript code with its corresponding HTML structure: function getCityChoice() { const location = document.querySelector("form").location.value; console.log(location) } <form name="reserve" a ...

Executing a post request asynchronously and storing the retrieved data into a variable

Currently, I am in the process of learning AngularJS and attempting to upgrade my current method of fetching data from a web service and dynamically assigning it to a variable that is binded using ng-repeat. My main objective is to implement an asynchronou ...

I've recently delved into the world of JavaScript and am currently working on creating a calculator website. However, I'm facing some challenges in getting it to function

I created a calculator code using HTML, CSS, and JavaScript for a website. However, due to my limited experience with JavaScript coding, I encountered some issues. Currently, I have only implemented the number input part (not operations or deletion), but w ...

What steps can I take to ensure my header appears perfectly aligned? (HTML/CSS)

My header on my website is all messed up with the links appearing incorrectly. I suspect it's an issue with style.css, so I attempted to modify the style.css file but had no luck. I have very limited experience with .css and cannot seem to figure out ...