Bootstrap 4 fails to adapt on mobile devices, causing columns to pile on top of each other

My website is optimized for desktop viewing, but I'm struggling to make it responsive on mobile using bootstrap 4.

Even though my custom columns have always worked in the past, they are now overlapping on top of each other instead of stacking correctly. This could be due to the specificity of this project or perhaps because I have background images for each section of my HTML page. Here is a snippet of my HTML code for some sections:

Example:

https://i.sstatic.net/gn2uX.png

The content from section 4 overlaps with section 3 on mobile devices.

HTML:

 <!--Section 3-->
    <div id="content3">
        <section>
            <h1 class="text-center integration">Integrating</h1>
            <div class="container-fluid integration_background">
                <div class="row">
                    <div class="col-md-6 d-flex justify-content-center">
                        <ul class="integrations">
                            <li><img src="img/g_suite.png" class="pr-4">
                            </li>
                            <li><img src="img/_slack.png" class="pl-4 pr-4">
                            </li>
                            <li><img src="img/groupme.png" class="pl-4 pr-4">
                            </li>
                            <li> <img src="img/microsoft.png" class="pl-4">
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <!--Section 4 -->
    <div id="content4">
        <section>
            <h1 class="text-center">Pricing</h1>
            <br>
            <div class="container-fluid d-flex align-items-center" style="width: 75%;" id="price_container">
                <div class="row">
                    <div class="col-md-4 text-center">
                        <div class="card">
                            <div class="card-header">Educator</div>
                            <div class="card-body d-flex flex-column">
                                <img src="img/price_edu.png" class="img-fluid">
                                <h6 class="card-title">Use Wanzeru Ed</h6>
                                <hr>
                                <ul>
                                    <li>Free for one class</li>
                                    <li>Matches students in ideal teams</li>
                                    <li>Real-time feedback</li>
                                </ul>
                                <button type="button" class="btn btn-block mt-auto" style="background-color: #2F8EE1; bottom:5px;">Get Quotes</button>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4  text-center">
                        <div class="card">
                            <div class="card-header">Individual</div>
...
      

CSS:

#content3 {
    background-image: url("img/back2.png");
    background-size: cover;
    height: 540px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.integration {
    margin-top: -180px;
    color: #fff;
}

.integration_background {
    background-color: #fff;
    text-align: center;
    align-items: center;
    margin-top: 30px;
    padding: 10px 30px 10px 30px;
}

.vertical_line {
    width: 1px;
    height: 110%;
    background-color: grey;
    float: left;
}

#content4 {
    margin-top: -120px;
}

Answer №1

Upon further examination, I discovered that the issue with my bootstrap columns was non-existent, bringing me immense relief. :) The problem stemmed from the fact that my background images varied in size and were not perfectly square, in addition to being transparent. As a result, aligning text on top of these backgrounds required adjusting the margin-top and bottom for most sections, throwing off the responsive design.

To rectify this, I had to implement numerous media queries for different screen sizes, particularly for phones and tablets. While not enjoyable, it was necessary to ensure proper alignment. Hopefully, sharing this experience will aid others facing similar challenges in the future as it was quite perplexing for me initially.

Answer №2

Consider including a <br> tag in your code. If your CSS is not inline, make sure to include the necessary <style> and </style> tags. This could be the reason for any alignment issues you are experiencing.

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

The issue of the footer kicking out of place in the HTML layout was successfully resolved after

I am in the process of creating a simple footer that will always stay at the bottom of the page. The content on the page will not exceed the screen size, eliminating the need for scrolling. (There are a total of 5 HTML pages, and I want the footer and head ...

Transferring information from an HTML form to a C# webservice through AJAX

I've created a form in HTML using Bootstrap within PHPStorm, and now I want to send the information to a C# webservice using AJAX. However, I'm unsure about what to include in the AJAX URL section (shown below). Here is the HTML/Bootstrap form I ...

Python code struggling to locate parent of specific HTML tag

I have been attempting to retrieve the parent element of a specific tag with the code provided below: # -*- coding: cp1252 -*- import csv import urllib2 import sys import time from bs4 import BeautifulSoup from itertools import islice page1= urllib2.urlop ...

What are some effective strategies for incorporating multiple Themes into an AngularJS project?

Currently, I am in the process of working on a project that involves utilizing AngularJS, UI Bootstrap, and Sass. The next step is to incorporate different themes that can be selected by the user. While I have successfully implemented the ability to apply ...

Unable to access the following element using jQuery's next() method

Can someone help me understand how the "next" function works in jQuery? I'm trying to reveal a hidden textarea when a span element is clicked. The hidden textarea is supposed to be the immediate next sibling of the span, but it's not working as e ...

Substitute the <body> tag with a different tag

I am attempting to use the following code to replace the <body> tag on a page with <body id="khanqah"> echo str_replace("%body%", "khanqah", "<body id='%body%'>"); Although it adds <body id="khanqah"> to the page, the or ...

The ability to rate the product in Livewire:Laravel is exclusively reserved for buyers

I have integrated the Livewire rating system into my Laravel e-commerce platform. Currently, all users can rate and comment on any product. However, I want to restrict this privilege to only buyers. ProductRatings.php class ProductRatings extends Componen ...

Chrome does not support CSS animation rotation over 360 degrees

After researching for hours, I've encountered an issue with my animation in Chrome. It seems that while transform: rotate(1080deg); works flawlessly in Firefox, it fails to rotate in Chrome. Surprisingly, I discovered that it only rotates in Chrome wh ...

Issues with video playback on Apple devices

When playing a video through the browser, I am using the following code: <video class="video"> <source src="video.mp4" type="video/mp4" />Your browser does not support the video tag. I suggest you upgrade your browser. </vid ...

Utilizing Python to manipulate the 'select' tag in HTML

Currently, I am attempting to retrieve events from an HTML page located at In my efforts to choose different areas using python script, I encountered a challenge with the following snippet of HTML code: <select data-ng-options="key as value.name for ( ...

Hover problem with multi-tiered navigation menu

My navigation is almost perfect, but I have one last issue to solve regarding the arrow image on a subnav that indicates there is another level of subnav. ul#css3menu ul span { background-image: url("images/arrowsub.png"); padding-right: 28px; } u ...

Arranging text within a td cell

This is what I currently have: <tr> <td colspan="4" style="font-size:7pt; font-color:red; font-weight: bold;"> PLEASE NOTE: SPECIFY THE ARTICLE IN AS MUCH DETAIL AS POSSIBLE </td> </tr> However, the text does not a ...

Showing nested arrays in API data using Angular

I would like to display the data from this API { "results": [ { "name": "Luke Skywalker", "height": "172", "mass": "77", & ...

Master the art of string slicing in JavaScript with these simple steps

I am attempting to utilize the slice function to remove the first three characters of a string within a JSON object. $(document).ready(function() { $.ajaxSetup({ cache: false }); setInterval(function() { $.getJSON("IOCounter.html", functio ...

Building four frames with HTML

I am looking to have four frames set up in an HTML document. However, with the current code provided below, only three frames are being generated. <!DOCTYPE html> <html> <FRAMESET cols="100%" rows="10%,90%" > <FRAMESET rows="100%,"& ...

Coldfusion: The Troubles of an Empty Link href="#" Error

For my CFWheels Coldfusion project, I have been utilizing Adobe Coldfusion Builder 3. In Coldfusion, when you want to output a variable, you typically do something like this: #variable_name# However, I am interested in incorporating an empty link into m ...

Enhance the user experience in Angular by implementing validation that dynamically adds a specific class to input

Looking to assign a specific class to an input element if validation fails. Here is a basic test code snippet: controller: vm.emsg = ''; if ((parseFloat(vm.sum1) + parseFloat(vm.sum2)) < 100) { vm.emsg = 'Hey, sum should be 100.&apos ...

List of elements inside an HTML box

In my current HTML project, I am trying to include a box on a webpage that contains a scrollable list of elements. I want the content inside the box to scroll independently without affecting the rest of the page. Is there a way to achieve this? ...

Combine the bootstrap button and dropdown menu side by side and adjust the width of the dropdown to be

Snippet: <div class="d-grid gap-2 d-md-block mt-1"> <button class="btn btn-secondary" id="btnSearch"><i class="fa fa-search fa-fw"></i>Search</button> <button class="btn ...

Ways to interact with a button that toggles between states

I am working with a button that has both an enabled and disabled state. Enabled State: <button type="button" class="btt-download-csv site-toolbar-menu-button icon-download no-icon-margins ng-isolate-scope" title="Download CSV" rc-download-csv="" curren ...