The Bootstrap website is experiencing issues with mobile responsiveness as a result of content overflow

As a newcomer to web development, I am currently working on a Bootstrap website. Everything seemed to be working fine in desktop mode, but I encountered an issue in the mobile view where some Bootstrap columns were overflowing, causing a vertical white space on the mobile screen. After inspecting the website using Chrome Developer Tools, I discovered that if I untick the following CSS:

.row {
  margin-right: calc(var(--bs-gutter-x)/ -2);
  margin-left: calc(var(--bs-gutter-x)/ -2);
}

I was able to solve the problem by adjusting the row values in my CSS file:

.row { 
  margin-left: 0%;
  margin-right: 0%;
}

Unfortunately, this code did not seem to take effect in the browser.

Below is an image depicting my issue:

https://i.sstatic.net/4GcC9.jpg

On the other hand, the solution provided by Chrome inspect tools worked perfectly:

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

Interestingly, this code worked fine on the Codeply online editor's mobile version but not on actual mobile devices or Chrome Developer Tools.

For more information on my project, please visit:

Answer №1

I have optimized your HTML code by restructuring it with a proper grid structure. The issue of extra space may be caused by the unstructured row class within the div. Additionally, I have removed the padding from the #title class to eliminate excess spaces. Please see the snippet below for reference.

body{ 
    width: 100%;
    margin: 0px;
    padding: 0px;
    overflow-x: hidden;}
.h1{
    font-family: 'Black Ops One', cursive; ;
  }
h1{
      font-family: 'Black Ops One', cursive;
  }
  
h2{
      font-family: 'DM Serif Text', serif;
  }
/* .row{
 margin-left: 0%;
 margin-right: 0%;
}*/
#title{
 background-color:#F8F5F1;
 /* padding: 1% 1%; */
}
.title-image{
    height: 100%;
    width: 100%;
    padding-right: 10%;
    padding-top: 10%;
    padding-bottom: 10%;
}
.name{
    font-size: 5rem;
    font-weight: 800;
    padding-right: 2%;
    padding-top: 30%;
}
/* menu bar */
.lg-bar{
    background-color: black;
    padding: 1% 5%;
}
.n2{
    padding: 0 18px;
    font-size: 2rem;
}
...
    height: 40px;
    width: 40px;
    width: var(--cd-back-to-top-size);
    box-shadow: 0 0 10px rgba(0, 0, 0, .05) !important;
    background: url(https://res.cloudinary.com/dxfq3iotg/image/upload/v1571057658/cd-top-arrow.svg) no-repeat center 50%;
    background-color: hsla(5, 76%, 62%, .8);
    background-color: hsla(var(--cd-color-3-h), var(--cd-color-3-s), var(--cd-color-3-l), 0.8)
}
.height {
    height: 3000px
}
   
<!DOCTYPE html>
<html lang="en">
...
</body>
</html>

Answer №2

For optimal results when using the row class, be sure to add the m-0 class as well. This should assist in resolving any potential issues you encounter.

Answer №3

After some trial and error, I managed to resolve my issue by including the gs-0 class tag in my bootstrap column padding. This adjustment successfully eliminated the default padding on my website, ensuring that the containers aligned correctly without any overflow.

During my search for a solution, I noticed that the vertical scrollbar often appeared in the browser due to the div overflow, particularly when working with images. To prevent image overflow, a simple solution is to apply the image class to the following code snippet.

img{
      width:100%;
      height:auto;  
     }

Additionally, you can experiment with using overflow-x: hidden; to eliminate the vertical scrollbar. However, in my case, this adjustment alone was not sufficient, as certain bootstrap columns were still overflowing in the mobile view. To address this, I had to remove their default paddings and ensure the viewport meta tag was included.

<meta name="viewport" content="width=device-width, initial-scale=1.0">

Another helpful tip is to enclose your divs with .container .container-fluid. Keep in mind that .container-fluid also includes default padding, which can be eliminated by adding p-0. This experience taught me the importance of these adjustments.

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

Issue with bootstrap-timepicker not functioning within ng-repeat loop

Check out the Plunker demo I have been experimenting with creating multiple instances of the timepicker. When I hardcode them, they function properly. However, once I attempt to put them into an ng-repeat, they stop working. Any suggestions on how to reso ...

Having an issue with the Show/Hide Javascript toggle on the same page. Multiple hidden texts are appearing simultaneously. Seeking a solution without the use of JQuery

This code is functioning efficiently. I am looking for a way to display and conceal various texts using different expand/hide links within multiple tables on the same page. I prefer to achieve this without using JQuery, just like in this straightforward sc ...

Tips for adjusting the font size within the MUI TextField Label

I'm looking to adjust the label fontSize in the material ui TextField component. I've discovered the InputLabelProps property which has been helpful, but as shown in the image below, the label appears too cramped when focused. https://i.sstatic. ...

Guide to creating a dynamic illumination using CSS, HTML, and JS

Can you help me create a unique lighting effect for a specific section of my webpage? I'm curious about the techniques needed to achieve a similar effect as seen on another webpage. Is it feasible to create this effect using only CSS and HTML, or are ...

Shift all content to the right when viewing on mobile devices

I'm looking to create space for a menu on the left side, similar to the one on Mashable's mobile view. How can I move all the content to the right? Feel free to resize the window and compare with . Thank you. Best regards, Marius ...

What is preventing me from adjusting the padding of the mat-button?

Trying to adjust the default padding of a mat-button, but encountering issues with changing the component's style. Any suggestions on how to subscribe to the default padding (16px)? I've attempted modifying CSS properties to set the padding of a ...

How to adjust background size for Iphone4 and Iphone5 simulators using only HTML5 and CSS3 code

Creating an HTML5 app for iPhone4 and 5 with a texture-rich background. I'm facing an issue where the texture image gets scaled and only the central part is visible, even though the image size is 640x960 and 640x1136. I've tried adding @2x at the ...

The stop-color property is not functioning as expected in CSS/SVG

Here is the code I am currently working with: <?xml version="1.0" standalone="yes"?> <svg xmlns="http://www.w3.org/2000/svg" width="360" height="240"> <style>stop{stop-opacity:1}circle{fill:url(#r)}</style> <defs> <radialG ...

Fetching the entire webpage

When attempting to load a specific webpage using an iframe, I encountered the following issue: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></ ...

Concealing a hyperlink depending on the value chosen in a dropdown menu

Looking for guidance on how to use jQuery to read the current value of a drop-down list and hide a specific link based on that value. The drop-down list is for selecting the language/locale. For example, when "English" is selected, I want the link to be h ...

Is there a way to change TextBox multiline to uppercase in Opera browser?

Does anyone know how to convert TextBox multiline to Uppercase in Opera? I tried using "text-transform:uppercase" but it only seems to work with IE ...

Tips for adjusting image size to take up only half of the screen in NextJS

Struggling to resize an image to fit only 50% of the screen in NextJS? The Image component provided by NextJS comes with its own inline styling, making it tricky to customize. Currently, I attempt to style the image by wrapping the Image component in a spa ...

What is the best way to show emojis in AngularJS?

Recently starting to work with angularjs, I've incorporated "emoji-min.js" and "emoji-min.css" into my project as an attempt to display emojis within a text field. Despite my efforts, the emojis are not displaying as intended. Here is a snippet of my ...

What is the reason that object-fit does not affect the width or height?

I am facing an issue with an image in a div where the image is not resizing properly when using object-fit: contain. The width of the image remains unchanged, causing padding to appear around it. https://i.stack.imgur.com/D0wym.png Is there a way to make ...

Including a logo and navigation bar in the header while collaborating with different subregions

I'm having trouble getting a picture to display in the header alongside a horizontal menu. I've divided the header into two sections: img and navbar (html). The navbar is showing up correctly, but the image isn't appearing. Any suggestions o ...

What is the best way to update or include a new class in the jQuery mobile loader widget?

After reviewing the documentation at this link: I discovered a method to modify or add the default class of the loader widget, ui-loader. Despite my attempts, I have not been able to see any changes. You can view my demo here: https://jsfiddle.net/yusril ...

Is there a way to automatically override the CSS cursor style?

Issue with SCSS styling on image link I attempted to modify the cursor style from pointer to default, but after saving and reloading my React app, the change did not take effect. I tried writing some code, but it seems that Stack Overflow is indicating an ...

Struggling to keep navbar fixed with a blur effect without it colliding with body content as you scroll?

I'm looking to create a sticky navbar with a blur effect similar to the one seen on (try scrolling to see the blur effect on the nav). I want it to have the following structure: My HTML code is as follows: <header class="sticky z-10 top-10"> ...

Using a combination of AND and OR in XPATH

Recently, I encountered the following HTML code: <div><h6>abc/h6><p>date</p></div> Using Selenium, I managed to locate this element based on text. However, the issue arises when <h6> can contain various words like "d ...

The anchor for the circular image is oversized

Currently, I have a PHP code that displays a user's profile picture, and when clicked, it takes them to their own profile. The image is displayed correctly, and the link works fine. However, there seems to be an issue with the area covered by the anch ...