Ensuring Bootstrap retains fullscreen tables while adjusting window size

I have set up a webpage containing a table and a footer. Utilizing bootstrap, I ensured that the footer remains visible while the table adjusts its height based on the remaining space on the screen.

While this resizing works perfectly when the window size is larger than the table, an issue arises when the window size shrinks too small. In such cases, I aim to implement a scrollbar for the table without affecting the visibility of the footer.

To better illustrate the problem, you can watch a video showcasing it here: https://www.youtube.com/watch?v=p3TPqvivW_8

Below is the snippet of code I am working with:

<div>
    <div className="container-fluid aaa">
        <div className="row justify-content-center min-vh-100">
            <div>
                <div className="d-flex flex-column h-100">
                    <div className="row justify-content-center bg-blue flex-grow-1 flex-nowrap">
                        <table className="table table-bordered table-dark table-hover">
                            <thead>
                                <tr>
                                    <th scope="col">Name</th>
                                    <th scope="col">IP</th>
                                </tr>
                            </thead>
                            <tbody>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                                <Device type="SRG-X120" ip="192.168.48.1"/>
                            </tbody>
                        </table>
                    </div>
                    <div className="row justify-content-center bg-purple">
                        <div className="text-white">
                            <Footer />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

Answer №1

To implement a custom scrolling feature, you can define a new class in your CSS:

.scrollable{
    overflow-y: auto;
}

Next, apply this class to the div element that wraps your table:

<div className="row scrollable justify-content-center bg-blue flex-grow-1 flex-nowrap">
  <table>...</table>
</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

Node.js has the ability to establish internal connections, however it cannot establish connections

I'm having an issue connecting to a JavaScript file on my local server. I'd like to input the external IP address and port in order for it to run externally. This functionality currently works when accessed locally. Below is the code from my serv ...

What steps should be taken to convert the field into a search icon?

Is it possible to change the field to an icon for mobile devices? See the example below: https://i.sstatic.net/UNZG8.png <html> <head> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" ...

While attempting to deploy on Vercel, I encountered an error while constructing my Next.js project

While working on my Next login signup project, I encountered the following error: WagmiProviderNotFoundError: `useConfig` must be used within `WagmiProvider`. The documentation for this issue can be found <a href="https://wagmi.sh/react/api/WagmiProvide ...

Are your Express routes failing to function properly?

I recently embarked on creating a new Express app by following the tutorial from Code Magazine. Below are my app and the defined route for /img. https://i.sstatic.net/G6PUG.png Upon trying to access http://localhost:3000/img or http://localhost:3000/img/ ...

Looking for a way to store data in a sub-document in MongoDB? I am having an issue where my farm sub-documents

After many attempts, I am still facing issues while saving farm data for a User. I created an API to sign up a user and save their data, including the farm object. However, every time I try to update the code, the farm object turns into null. The goal is t ...

What is the process for activating JavaScript and embedding it into an HTML document?

I am currently utilizing a JavaScript API that contains several functions. How can I incorporate it into an HTML file? One of the functions, "api.ping()", performs well on PowerShell, but I am encountering difficulties with displaying it on an HTML file. ...

What may be causing the MuiThemeProvider to override the style of a component?

Within my outer component, I am utilizing MuiThemeProvider: <MuiThemeProvider theme={full_theme_e}> <div> <AppBar /> <Filter /> </div> </MuiThemeProvider> Inside the Filter component, I have specified a ...

What could be the issue with this JavaScript if/else statement?

My goal is to have the text "open" displayed when the navigation bar is not visible, and when it is visible, the text "open" should be hidden. I am new to HTML and JavaScript, and I wrote the following code, but it is not working as expected. Can someone p ...

Issues with customizing material-UI styling are persisting

Recently delving into the world of material UI, I have encountered an issue while trying to customize the CSS of a material UI tabs component. <Tab key={`${tab}_${index}`} classes={{ flexcontainer: css.tabFlexContainer }} disableRip ...

Deleting all JSON files in a directory using NodeJs

Is there a way to delete only the json files within a directory (multiple levels) without specifying each file name individually? I thought fs-unlinkSync(path) might work, but I haven't found that solution yet. I attempted to use the following method ...

Sequelize is currently running a process that is creating various versions of tables with unique file names, foreign keys, and initialized values in each version

After following advice to change the names of my models to match the defined ones, I now find myself with multiple tables created for the same model in PGadmin. This has led to issues with initialized values and foreign keys appearing on different tables. ...

Issues with Angular updating the *ngFor Loop

I'm looking to showcase a lineup of upcoming concerts in my HTML, sourced from a web API (which is functioning correctly). The API is encapsulated within a ConcertService: @Injectable({ providedIn: 'root' }) export class ConcertService { ...

Using a union type annotation when passing into knex will result in the return of an unspecified

Knex version: 2.5.1 Database + version: postgres15 When passing a union typescript definition into knex as a type annotation, it returns the type any. However, by using type assertion as UserRecord, we can obtain the correct UserRecord type. It is my un ...

utilizing JavaScript to obtain JSON data within an EJS document

Hello, I'm currently facing an issue with my code and would appreciate any help to resolve it. Here is a snippet from my Node.js server file: //setup var express = require("express"); var request = require("request"); var bodyParser = require("body ...

There seems to be an issue with Node.js using express and websocket as it is encountering an error during the WebSocket handshake, displaying

Currently, I'm working on setting up a website with websockets, where both the HTTP server and the websocket listen on the same port: const WebSocket = require('ws'); var express = require('express'); var app = express(); wss = ...

tips for invoking the parent constructor within an event method

Whenever I attempt to execute this code with the expectation of printing "Mohammed said: hi guys", an error occurs indicating that #person is not a function. What could be causing this issue? var events = require('events'); var util = require(&a ...

Collaborating with interactive icon in input group

I'm having trouble getting the textbox and icon to be in the same line, like a bootstrap input group. The icon is also clickable. <div class="input-group"> <asp:textbox id="txtParentCategoryCode" runat="server" cssclass="input-text normal" m ...

Issue with ThreeJs: Difficulty loading separate images on top and bottom surfaces

I've been trying to place different textures on the top and bottom sides using Threejs to display unique images on each side. However, I'm encountering an issue where the same image is being displayed on both the top and bottom sides. Below is th ...

Is it possible to incorporate MUI React components within an iframe?

Looking to replicate the style seen in this Material UI website screenshot, I aim to design a container that will encompass my iframe contents, such as the navBar and menu drawer. However, I want to utilize Material UI's components for these elements. ...

Is the vertex count of a Geometry in Three.js increased when it is converted to a BufferGeometry?

Recently, I've been experimenting with the fromGeometry method to convert regular Geometry objects into BufferGeometry objects. To my surprise, I noticed that the number of vertices increases during this conversion process. For instance, consider the ...