What could be causing the overflow of my <table> data from its parent <div> container in Bootstrap?

Currently, I am trying to utilize angular in conjunction with bootstrap to present my data. I have mock data stored within a component and displayed in the html file of that component. However, I am facing an issue where when the table expands in size, it does not appropriately adjust (become responsive) to fit its parent container. Instead, it overflows beyond the container and extends into the footer component.

This snippet highlights my index.html:

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>Title goes here</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>

<body>
  <app-root></app-root>
</body>

</html>

Furthermore, this is my app.component.html, essentially directing to my home component:

<router-outlet></router-outlet>

The following represents my home.component.html:

<div class="container-fluid" style="height: 100%; background-color: rgba(255,0,0,0.1);">
  <div class="row" style="height:13%; background-color: rgba(136, 255, 0, 0.1)">
    <div class="col-md-12">
      <app-header></app-header>
    </div>
  </div>
  <div class="row" style="height:77%;">
    <div class="col-md-2" style="height:100%; background-color: rgba(255, 0, 179, 0.1)">
      <app-sidemenu></app-sidemenu>
    </div>
    <div class="col-md-10" style="height:100%; background-color: rgba(170, 48, 58, 0.1)">
      <app-cashplanner></app-cashplanner>
    </div>
  </div>
  <div class="row" style="height:10%; background-color: rgba(16, 16, 212, 0.1)">
    <div class="col-md-12">
      <app-footer></app-footer>
    </div>
  </div>
</div>

The data meant for display resides within the <app-cashplanner> component. The contents of the cashplanner.component.html appear as follows (imagine numerous rows are present here):

<div class="container">
  <div class="row">
    <table id="dt-material-checkbox" class="table table-striped" cellspacing="0" width="100%">
      <thead>
        <tr>
          <th></th>
          <th class="th-sm">Position
          </th>
          <th class="th-sm">Office
          </th>
          <th class="th-sm">Age
          </th>
          <th class="th-sm">Start date
          </th>
          <th class="th-sm">Salary
          </th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td></td>
          <td>System Architect</td>
          <td>Edinburgh</td>
          <td>61</td>
          <td>2011/04/25</td>
          <td>$320,800</td>
        </tr>
        <tr>
          <td></td>
          <td>Accountant</td>
          <td>Tokyo</td>
          <td>63</td>
          <td>2011/07/25</td>
          <td>$170,750</td>
        </tr>
        <tr>
          <td></td>
          <td>Junior Technical Author</td>
          <td>San Francisco</td>
          <td>66</td>
          <td>2009/01/12</td>
          <td>$86,000</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <th>Name
          </th>
          <th>Position
          </th>
          <th>Office
          </th>
          <th>Age
          </th>
          <th>Start date
          </th>
          <th>Salaryzz
          </th>
        </tr>
      </tfoot>
    </table>
  </div>
</div>

Hence, the abovementioned table in my cashplanner spills out of its container once viewed in the browser, without the footer dynamically adjusting to the table above it. While I plan to implement pagination for the data, my understanding was that the bootstrap classes should adapt accordingly to both the browser and its encapsulating div tags.

To visualize this concern, you can view the illustration below where the overflow occurs...

https://i.sstatic.net/8PSJ0.png

Answer №1

Consider applying the table-responsive class to a div that wraps the table.

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

Tips for resolving the issue with "Text Animation"

Could someone please help with fixing this CSS animation? I want to align the text animation to the paragraph properly. I'm not confident if I am approaching this in the correct way, so if there is a simpler solution out there, I would appreciate lea ...

My Angular project is not being recognized by the Jenkins pipeline

I am currently working on a project with a more intricate structure, which looks like this: 'rootFolder/frontendParentFolder/actualAngularProject' Within my Jenkins job, I am attempting to execute the code coverage task for the angular project. ...

Create a dynamic animation using Angular to smoothly move a div element across the

I currently have a div with the following content: <div ng-style="{'left': PageMap.ColumnWrap.OverviewPanelLeft + 'px'}"></div> Whenever I press the right key, an event is triggered to change the PageMap.ColumnWrap.Overvie ...

Incorporating TinyMCE into numerous dynamically generated text areas

I am facing an issue with dynamically created textareas. The content in these textareas is generated dynamically. This is how I retrieve the data and create the textareas dynamically: $(document).ready(function(){ $('#btn').click(function(){ ...

Do not ask for confirmation when reloading the page with onbeforeunload

I am setting up an event listener for the onbeforeunload attribute to show a confirmation message when a user attempts to exit the page. The issue is that I do not want this confirmation message to appear when the user tries to refresh the page. Is there ...

Retrieving pictures by their unique identification number

Utilizing a flexslider, I have set up an image display feature as shown in the JSFiddle link below. The slider has been optimized to dynamically extract images from a specific directory, where images are named with numbers like 1023, 2045, 304654, and so o ...

Is there a way to include a button at the top of the Notiflix.Loading() overlay for closing or stopping it?

I've integrated the "notiflix" library into my project, and I'm currently using notiflix.loading.pulse() for a lengthy process. While this works perfectly fine, I would like to add a button (for closing/stopping the process) on top of the loading ...

What is the best way to implement Bootstrap 4 tabs in UI to trigger a post request with each button click?

Using bootstrap 4 with a bearer token in asp.net core 2.2, I am looking to implement tabs for better user navigation. Where should I begin? Reviewing my coworker's code, I noticed only one post method on the entire form. Is there a way to send data to ...

How can we automate the process of assigning the hash(#) in Angular?

Is it possible to automatically assign a unique hash(#) to elements inside an ngFor loop? <div *ngFor="let item of itemsArray; index as i"> <h3 #[item][i]> {{ item }} </h3> </div> I would like the outp ...

Error: Undefined object trying to access 'vibrate' property

Good day, I apologize for my poor English. I am encountering an issue with Ionic Capacitor while attempting to utilize the Vibration plugin. The documentation lacks detailed information, and when checking the Android Studio terminal, I found the following ...

Ways to enlarge the parent container and reveal a concealed child element upon hovering without impacting neighboring containers

Currently, I am diligently working on the company service boxes and have a particular need... When hovering over: 1. The parent div should scale up and acquire box shadow without impacting the neighboring service boxes (it should appear to stand out above ...

Angular 2 Release Candidate 1 brings a plethora of new features such as multiple components support, a Todo List

Designing a to-do list with the capability to add tasks has been successful so far using one component (Tasklist) and one service (Taskservice). However, upon attempting to divide the functionality into multiple components (Tasklist and Addtask), an issue ...

The output of VueJs hooks shows a blank refs object first, followed by the referenced elements

Below is the HTML VueJS code sample that I am working with: <div v-for="site in topSites" ref="ts"><a :href="site.url"> ... </div> Update: Here is the full div code: <div v-for="site in topSites& ...

Transitioning to mui5's sx prop instead of makeStyles is generating a typescript error - none of the overloads match this call when passing an object with

I encountered an issue while converting a component to mui 5. Here is the original code snippet: const useStyles = makeStyles({ imageContainer: { display: "flex", width: "65%", float: "left", marginRight ...

Protractor performs the afterEach function prior to the expectations being met

I am completely baffled by the behavior of this code. Everything seems to be executing correctly up until the 'expect' statement, at which point it abruptly navigates to a new page and runs the afterEach function. I've tried various solution ...

Chrome reload causing page to automatically scroll to bottom on my website

Could really use some assistance in solving this problem as I am completely stumped. I've noticed an issue on one of my websites when pages are reloaded. Every now and then (not consistently, which adds to the confusion), upon refreshing a page, it ...

Creating a form with required fields in Angular and using the ngIf directive

Update: modified the sample code to incorporate TypeScript for better clarity I have a form with various buttons for users to choose from. The submit button is initially disabled until a user selects a button. However, there's a unique requirement wh ...

What are some ways to customize the appearance of React Semantic components?

Is there a way to apply CSS for react semantic UI when using create react app? I have installed semantic-ui-react and included the CSS CDN: loginForm.js: import React from "react"; import { Button, Form, Header } from "semantic-ui-react"; import styles f ...

Creating space between flex items in Slick Carousel with Vue

This is my current Slick Carousel. There are 4 items in a row, and I am looking to insert some margin between each item while maintaining the existing aspect-ratio: 1.3/1; I'm struggling with overriding the classes from vue-slick-carousel. Does any ...

Is it necessary to install only form control styles from Bootstrap 4?

Does Bootstrap 4 offer a way to only install the form control styles like input group? I came across a resource that allows you to solely install the Bootstrap 4 Grid. Is there anything similar for downloading just the form styles? ...