Why is it that all the columns seem to be stacked into just one column?

I've encountered an issue while trying to slice an image using HTML/CSS. My form, which I want to display in 3 columns, instead appears in a single column.

The only time it works as intended is when I place my form and another div in the command section. However, I prefer to keep them separate if possible.

I'm currently working with Bootstrap 4.

HTML:

<header id="home">
    <div class="container">
        <div class="row besspar-form-div">
            <div class="form-div">
                <form action="" method="post">
                    <div class="form-group col-md-4 width-36p">
                        <p>
                            <img src="img/phone-round.png" alt="" class="img-phone">
                            <img src="img/phone-round-or.png" alt="" class="img-phone-or">
                            Om welk toestel gaat het?
                        </p>
                        <select name="brand" class="form-control round-control" required>
                            <option value="">SELECT JE MERK</option>
                            <option value="Apple">Apple</option>
                            <option value="Samsung">Samsung</option>
                            <option value="Huawei">Huawei</option>
                            <option value="opt-seprator" disabled>───────────────</option>
                            <option value="Motorola">Motorola</option>
                            <option value="Sony">Sony</option>
                            <option value="LG">LG</option>
                            <option value="OnePlus">OnePlus</option>
                            <option value="HTC">HTC</option>
                        </select>
                    </div>
                    <div class="form-group col-md-4 width-36p">
                        <p>
                            <img src="img/mailbox.png" alt="" class="img-mail">
                            <img src="img/mailbox-or.png" alt="" class="img-mail-or"> Wat is je postcode?
                        </p>
                        <input type="text" name="pincode" class="form-control round-control" placeholder="1234 AB" required>
                    </div>
                    <div class="form-group col-md-4 width-28p">
                        <button type="submit" class="btn btn-prijzen">
                            Prijzen vergelijken
                        </button>
                        <p class="fs-16b">
                            <span class="small-circle"></span>100% Gratis en vrijblijvend
                        </p>
                    </div>
                </form>
            </div>
        </div>
    </div>
</header>

CSS:

.round-control {
    border-radius: 25px;
    border: 1px solid #ccc;
    height: 400px;
    color: inherit
 }

div.besspar-form-div {
    padding: 40px 0px;
    background-color: #FFFFFF;
    margin: 30px auto;
    border-radius: 15px;
}

div.form-div {
    width: 90%;
    margin: auto;
}

.img-phone, .img-mail {
    display: inline-block;
}

.img-phone-or, .img-mail-or {
    display: none;
}

select {
    -webkit-appearance: menulist-button;
    background: url("../img/down-arr.png") 96% / 15% no-repeat #eee;
    background-size: 16px;
}

p.fs-16b {
    font-size: 16px;
    font-family: Montserrat-bold;
    color: #ffad18;
    padding-bottom: 0px;
    padding-top: 10px;
}

.small-circle {
    content: "\25CF";
    font-size: 20px;
    color: #3EB7D3;
}

I anticipated that the columns would divide the form content into 3 separate columns. However, all the content is currently appearing in a single column.

Answer №1

It is crucial that .col-md-4 is the direct child of .row.

Following structure works perfectly:

<div class="row">
    <div class="col-md-4"></div>
    <div class="col-md-4"></div>
    <div class="col-md-4"></div>
</div>

However, the following structure will not work:

<div class="row">
    <div class="something">
        <div class="col-md-4"></div>
        <div class="col-md-4"></div>
        <div class="col-md-4"></div>
    </div>
</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

What is the process for implementing filtered HTML attributes in a directive?

I’ve created a custom directive that generates a popup menu by extracting data from HTML content. The purpose is to transform a group of Bootstrap carousel-compatible elements into a structured list. However, each .item element contains an attribute with ...

Press the smiley icon and drag it into the designated input box

Is there a way to select and copy a smiley/emoji from a list and paste it into an input field? Although the Inspect Element Q (console log) shows that the emoji is being clicked, I am having trouble transferring it to the input field. Here is the HTML cod ...

Exploring the possibilities of integrating Storybook/vue with SCSS

After creating a project with vue create and installing Storybook, everything was running smoothly. However, as soon as I added SCSS to one of the components, I encountered the following error: Module parse failed: Unexpected token (14:0) File was process ...

Allow iframe to be edited within jsfiddle

I have a question that I need to ask soon, but first I need an editable iframe in jsfiddle. It's working fine on my local machine, but not on jsfiddle. I believe it's because of the frames being used? On my local machine, I use: setTimeout(&apo ...

Having trouble displaying background images on GitHub pages?

I have encountered an issue with images not displaying correctly on GitHub Pages, despite trying various solutions suggested in previous posts. Strangely, the page functions perfectly on my local machine and on Netlify, but on GitHub Pages all the images a ...

Full-screen and auto-cropping capabilities are featured in the Bootstrap 4 carousel design

Is there a way to make full-width images in the bootstrap 4 carousel cropped based on position: center, background: cover to prevent scrolling issues? I attempted to follow advice from this webpage but encountered stretching and scroll-bar problems with d ...

Customizing checkbox appearance without including a label

After following a tutorial on how to style checkboxes found here, I was able to create a custom styled checkbox. However, I noticed that when I removed the label from the checkbox, it disappeared and was no longer visible. Is there a way to display the c ...

Customize the underline color of Material-UI's Input component

Trying to create an input component with a white underline. However, the underline color changes to black when hovering over it. It should remain white. Override the underline class as shown in the demo and instructions below. Despite trying to implement t ...

Revitalizing HTML and Google Maps with AJAX, PHP, and JQuery

Context: I am currently working on a project that involves integrating a Simple Google Map with an HTML form right below it. The form collects user input and upon submission, sends the data via AJAX to a PHP script for processing API calls and generating i ...

Split the input string into individual characters for each entry

As a beginner in Angular, I am currently exploring ways to split a single input field into separate inputs for each word. I attempted to achieve this using jQuery but struggled and also learned that mixing jQuery with Angular is discouraged. Here's th ...

Safari does not stop the scrolling of the <body style="overflow-y: hidden"> tag

Welcome to this simple HTML page <body style="overflow-y: hidden"> ... </body> This page is designed to prevent scrolling by using the CSS property overflow-y: hidden. While this functionality works as intended on most browsers, it does ...

Changing the Style of a CSS Module Using JavaScript

Embarking on a journey into Javascript and React, I am currently working on my first React app. My aim is to adjust the number of "gridTemplateRows" displayed on the screen using a variable that will be updated based on data. Right now, it's hardcode ...

Please enter only numerical values using jQuery

Currently, I am facing a slight issue. My goal is to only run the code when the input characters are numbers. This is the snippet of code I have been working with: $(".jq-sales, .jq-variablecosts, .jq-fixedcosts, .jq-additional-sales, .jq-sales-units, .j ...

Solution: Resolve clientY scrolling issue within an HTML document

I am facing an issue with the positioning of my context menu. When I right-click and scroll down, the menu does not maintain its regular position. Instead of appearing to the right of the mouse cursor when stationary, it moves below the cursor based on how ...

Check for the presence of a file in the directory and if it exists, load

Attempting to explain this query may lead to confusion. I have been searching for an answer for approximately three days with no success. It appears that the task at hand is either impossible or so straightforward that no one has encountered the need to in ...

How can we determine the total character count of a file that has been loaded into a textarea

I have a textarea where I can count the number of characters as I type. function calculateCharacters(obj){ document.getElementById('numberCount').innerHTML = obj.value.length; } <textarea name="textField" id="my_textarea" class="text_edit ...

Having difficulty implementing datetimepicker with Bootstrap 4 on NPM

I've been facing an issue trying to get datetimepicker to work on Bootstrap4 using npm. Despite compiling the code without any errors and inspecting without finding any issues, it seems that the CSS is not loading properly for the plugin. Here are th ...

Tips for creating dynamic row styles in a fluid table layout?

Could someone help me figure this out? I'm not familiar with JavaScript and need assistance as I've never created it, only edited existing scripts. I have a layout with two tables side-by-side. On mobile devices, the second table is pushed below ...

Seeking a JavaScript tool specialized in compressing POST data?

Currently working on a chrome extension that sends HTML strings to a server using POST requests. Interested in compressing these large strings before sending them. Wondering if there are any JavaScript libraries that can help with this? ...

How can you configure fancybox3 to open exclusively on a double-click?

Looking for a solution to open a fancybox gallery with a double click on a grid of sortable images. The goal is to be able to focus on an image with a single click, allowing for sorting using keyboard commands rather than drag and drop. I attempted to use ...