The flexbox container refuses to expand, causing the content to spill over the edges of

I am facing an issue with my flexbox container in React and Bootstrap. Despite following the correct grid system of container, row, and column, my container is stuck at a fixed height causing the content to run off the page when there are too many elements. I need help figuring out what's causing this problem. Can anyone assist me?

<>
    <NavBar />
    <div className=" test container-fluid p-0 ">
      <div className="row text-center"> 
        <div className="col p-0">
             {
              numberOfVisitors.length === 0 && 
                <h2 className="p-3 mb-0 bg-dark bg-gradient text-danger">
                  Sorry, the Firestore free tier quota has been met for today. Please come back tomorrow to see portfolio stats.
                </h2>
            }
            {currentNumberOfVisitors}
          </div> 
        </div>
      <Router>
          <div className="bg-image">
            <div className="position-relative">
                <Routes>
                  <Route path="/" element={<Home />} />
                  <Route path="/about" element={<About />} />
                </Routes>
              <div className="row">
                <div className="col">
                  <h4 className="text-dark text-center">Comments</h4>
                </div>
              </div>
              <div className="row">
                <div className="col d-flex justify-content-center">
                  <div className="comments-container" >
                    {
                      userComments.length === 0 && 
                        <h4 className="text-danger bg-dark m-1 p-1">
                          Sorry, the Firestore free tier quota has been met for today. Please come back tomorrow to see portfolio comments.
                        </h4>
                    }
                    {listOfUserComments}
                  </div>
                </div>
              </div>
              <div className="row text-center">
                <div className="col">
                  <h4 className="text-dark">Leave a comment</h4>
                  <h1>something</h1>
                  <h1>something</h1>
                  <h1>something</h1>
                </div>
              </div>
              <div className="row flex-column">  
                <div className="col d-flex justify-content-center">
                  <form className="" style={{ width: "500px"}}>
                    <MDBInput className="text-dark fw-bold" id='form4Example1' wrapperClass='mb-4' label='Name' onChange={(event) => setName(event.target.value)} />
                    <MDBTextArea  className="text-dark fw-bold" label='Comment' id='textAreaExample' rows={4} onChange={(event) => setComment(event.target.value)} />
                    <MDBBtn onClick={addComment} block size="lg">
                      Post Comment
                    </MDBBtn>
                  </form> 
                </div>
              </div>
            </div>
          </div>
        </Router> 
    </div>
    <Footer />
  </>
body 
{
  font-family: Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
html, body
{
  height: 100% !important;
}

.navbar-nav > li > a:hover  
{
  color: #33b5e5  !important;
}

.bg-dark.text-white.text-center > .text-center.p-3 > .text-white:hover
{
  color: #33b5e5  !important;
}

.bg-image 
{
    height: 100vh;
    background-image: url("./assets/images/bg-image.jpg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

.comments-container
{
  width: 500px; 
  border: solid black 1px;
  overflow-y: scroll;
}

To better understand my issue, please refer to the following screenshots: screenshot 1 screenshot 2

The first screenshot shows the layout as intended, but in the second screenshot, you can observe that when there are too many elements added to the container, the height remains unchanged, causing elements to overflow off the page.

Answer №1

Make sure to include flex-wrap alongside the d-flex class

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

Using HTML5 Video Tag for playing .mov files

I'm running into some issues with a video code I'm trying to incorporate in my project. To troubleshoot, I've created a basic test page to see if there's any errors on my end. Here's the link: The only difference in this code is ...

CSS unexpectedly altering a selected radio button choice

I am facing an issue with a 5-star rating system (radio buttons) that is intended to be used in two separate questions. The problem arises when the ratings for each question seem to be linked, causing a selection made in one question to affect the other. ...

Issue with opening mobile app from deep link in HTML email

My HTML form contains a deeplink that is submitted through the SendGrid API on nodeJS. After sending the email, users can view it but are unable to click on the deeplink. <!DOCTYPE html> <html> <head> ...

Error in positioning Bootstrap submenus

When the lower elements of the 1st submenu have fewer 2nd level submenu elements, the 2nd level of submenu is placed next to the 1st level submenu's 1st element. However, users are unable to navigate to the new 2nd level submenu because the mouseover ...

The onChange event in React Radio does not trigger when a different radio button is selected

Why is my onChange function not triggering when a radio component is deselected by another radio with the same group name? Here's the code for my radio component: import { useState } from 'react'; const RadioButton = (props) => { co ...

What is the best way to dynamically duplicate the Bootstrap multi-select feature?

$(function() { $('#days').multiselect({ includeSelectAllOption: true }); $('#btnSelected').click(function() { var selected = $("#days option:selected"); var message = ""; selected.each(function() { message ...

Is it possible to incorporate pre-written HTML code into ASP.NET?

Is there a method to transform an HTML template into ASP.NET? I am attempting to convert a website template, which includes Javascript and CSS files, from HTML to ASP.NET in order to establish a connection with a SQL Server database. I have minimal coding ...

How to wait for the webpage to fully load before executing a script using a Chrome extension

After opening a new website tab, I am attempting to select a DOM element by its class name. The issue I have encountered is not knowing how to effectively wait until the entire page has finished loading. Despite trying various methods such as alarms, setTi ...

What are the steps to find and remove a group of attributes in HTML using Vim?

Hey there, I could really use some assistance with vim and regex. I currently have an HTML file containing multiple instances of class="...", such as: <td class="td_3"><p class="block_3">80 €</p&g ...

Angular 10 Compilation Error "NG8001 error: The element 'mat-card-title' is not recognized:

Recently, I encountered a compile error while trying to view my changes locally using the command 'ng serve'. The error is related to all of the imported modules in my components and displays messages like: 1. If 'mat-card-title' is an ...

Adjusting scroll position delay for a fixed element when using an Android device

I am experiencing an issue with an element that is supposed to become fixed when scrolling past 145px and then unfixed when scrolling back up. While this functionality works smoothly on desktops, there seems to be a delay on mobile devices, particularly on ...

Extracting timestamp from date object using EJS - Working with JavaScript, HTML, and Node.js

I've been working on looping through and displaying objects on an EJS webpage. The loop is functioning correctly, and all other data is being displayed properly. However, I'm facing an issue with trimming the timestamp off of a date attribute tha ...

List with Columns for Organization

I am not seeking advice on how to use columns in lists, but rather on aligning the columns on my website. Below is the code I have: <ol class="threecolumns"> <li>Item 1</li> <li>Item 2</li> <li>Item 3< ...

Sound continues playing even when iPad browser safari is minimized

While working on a game developed in html5, jQuery, and Javascript, I am facing an issue with preloading multiple audio files. The audios play sequentially, but when I minimize the iPad, the audio continues to play. Can anyone assist me in pausing the au ...

Switching between displaying or hiding one of two backgrounds within a div using CSS and jQuery

Seeking guidance on implementing a two-background div setup where A is constantly displayed within the element and toggling B based on button control click. HTML <div class="container"></div> CSS .container{ url(B.png) 10px 10px no-repeat ...

What could have caused this issue to appear when I tried running ng build --prod?

Issue encountered while trying to build the ng2-pdf-viewer module: An error occurred in the webpack loader (from @angular-devkit/build-optimizer) with the message: TypeError: Cannot read property 'kind' of undefined. This error is related to A ...

Animating a jQuery Knob as you scroll from 0 to a set value

I am new to jQuery and currently working on jQuery Knob. Everything is functioning properly, but I have encountered an issue. When scrolling to the section with the knobs, I would like them to animate from 0 to a specific value. Is there a way to achieve ...

The Jquery css function does not support the setting of CSS3 variables

Hello there, I'm currently experimenting with CSS3 variables to adjust elements and various other things dynamically, but I've run into an issue where JQuery's css method seems to ignore any attempt to set a CSS variable. Here is what I&apo ...

I am unable to utilize the backspace function within a text box generated by JavaScript

I have created a dynamic form using JavaScript that includes buttons and one text input field. However, the issue is that to delete the text entered in the input field, one must highlight the text and then type over it instead of being able to simply use t ...

Exploring the syntax for navigating with JS Angular and HTML, such as when using the code snippet: ng-click="save(userForm)"

I am struggling to grasp the functionality of a specific part of this code. Despite my efforts to find tutorials, I have been unable to locate relevant information. There are two lines in particular that puzzle me: <button type="submit" class="btn btn ...