Overflow of content from `div` on top of the window

I have a section with tabs, each tab displaying different content. One of those tabs contains a table taller than the screen size. When I open it, the section stretches and overflows from the top, extending beyond the window. Despite having overflow:auto set on the parent container, the child element still overflows from the top. Initially, the child div is a small box centered on the screen, with its height based on the content.

I am utilizing bootstrap for assistance.

.parent
{
    background-image: url("images/CM3A2078.jpg");
    background-position: 20%;
    background-size: cover;
    display: flex;
    flex-direction: column;
    padding: 0;
    position: relative;
    overflow: auto;
}

.child
{
    position: absolute;
    min-height: 250px;
    background-color: rgba(255,255,255,0.6);
    border-style: solid;
    border-color: #FF6400;
    border-radius: 25px;
    transform: translate(0, -50%);
    padding: 20px;
    margin-left: 25px;
    margin-right: 25px;
    top: 50%;
    width: calc(100% - 50px);
    min-width: calc(100% - 50px);
}
.h-full
{
    min-height: 100vh;
}
<body>
<div class="container-fluid h-100">
    <div class="row h-full">
        <div class="col-lg-2 col-md-2 col-sm-1 col-1 side h-full">
            <div class="purple-gradient-left"></div>
        </div>
        <div class="col h-full parent">
            <div class="child">
                <div>
                    Some content
                </div>
                <div>
                    <br>
                    <div class="row">
                        <div class="col-2">
                            <button type="button" class="btn btn-primary btn-lg btn-disconnect">Disconnect</button>
                        </div>
                        <div class="col">
                            <ul class="nav nav-tabs tab-display justify-content-end" role="tablist">
                                <li class="nav-item ">
                                    <a class="nav-link active" data-toggle="tab" href="#home">Administration</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" data-toggle="tab" href="#menu1">Reservation</a>
                                </li>
                                <li class="nav-item">
                                    <a class="nav-link" data-toggle="tab" href="#menu2">Cancellation</a>
                                </li>
                            </ul>
                        </div>

                    </div>
                    <div class="tab-content">
                        <div id="home" class="container tab-pane active"><br>
                            <h3>HOME</h3>
                            <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
                                incididunt ut labore et dolore magna aliqua.</p>
                        </div>
                        <div id="menu1" class="container tab-pane fade"><br>
                            <h3>Reservation</h3>
                            <?php include 'processing.php'; ReservationTable(); ?>
                        </div>
                        <div id="menu2" class="container tab-pane fade"><br>
                            <h3>Menu 2</h3>
                            <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
                                laudantium, totam rem aperiam.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-2 col-md-2 col-sm-1 col-1 side h-full">
            <div class="purple-gradient-right"></div>
        </div>
    </div>
</div>
</body>

An image demonstrating the issue can be viewed https://i.sstatic.net/4gaGv.png.

Answer №1

Include the following code snippets in your CSS stylesheet.

* {
       box-sizing: border-box;
  }
.child 
  {
        max-height: 100%;
  }

Answer №2

After some trial and error, I managed to fix my issue by replacing position:absolute with position:sticky within the nested div.

Answer №3

To achieve wrapping, apply flex-wrap: wrap to the parent element:

display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;

Consider these additional options for customization:

height: 100vh;
width: 100vw;
overflow: scroll;

Answer №4

To modify the .parent style, include the following code:

height: 100%;

Then, update the body style with the following code:

body{
    margin:0;
}

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

When attempting to authenticate the login, nothing occurred upon submission

login.html in (authenticate/login.html) {% extends "events/base.html" %} {% block content %} <h1>Login</h1> <br><br> <form action="" method="POST"> {% csrf_token %} <form> <div ...

CSS: Setting the minimum width of a table in your web design

I am facing an issue with a table that should expand to fill 100% of the width, but also need it to respect a min-width rule when I resize my browser window. Unfortunately, setting a min-width directly on the table does not seem to work (tested in Safari&a ...

Utilizing a nested div structure for web design

Forgive my lack of expertise in web programming, as my knowledge is limited and I struggle with finding the right terms even through online searches. With that said, my question (which may be worded oddly due to my lack of familiarity with the topic) is: ...

Working with PHP and CodeIgniter to highlight active nav-link in Bootstrap for a subdirectory

Just starting out with Bootstrap and running into a little issue. Spent some time on it but can't seem to figure it out. Perhaps it's something simple that I'm overlooking. Essentially, my goal is to keep the nav-link active when navigating ...

Using JavaScript to empty input field when switching focus between input fields

I am experiencing an issue with clearing a input number field. Here is the code snippet in question: <input class="quantity_container" v-model="length.quantity" type="number" pattern="[0-9]*" inputmode="numeric" onfocus="if (this.value == &ap ...

Is it feasible to create a tabbed layout that is responsive?

Would it be possible to create a layout like this and how would you go about doing it? The container has borders, except at the top where the tabs are located. Only the selected tab should have a border at the top. The text on the tabs should be centered, ...

The Bootstrap modal popup fails to appear when utilizing the fade animation effect

I incorporated Bootstrap's JavaScript modal plugin into my application to introduce dialog boxes. While I am able to use it successfully, I encountered an issue when attempting to implement a fade animation when opening or closing a modal dialog. Fol ...

Why does it seem like only one div is being added?

I am facing an issue with dynamically appending multiple div elements. Despite my efforts, only one div element is showing up on the browser when I try to test the code. I have searched for similar problems but could not find any solutions. Any assistanc ...

Looking for assistance in implementing specific styling techniques with React

Trying to implement a slider on my React page sourced from a Github repository. The challenge lies in adding the CSS as it is in JS format. Even after incorporating webpack and an npm compiler, the styling seems unrecognized. Any suggestions or solutions ...

The integration of single page applications and <form> elements is a powerful combination in web development

Is there still value in using a <form> element over a <div> element when developing single page applications? I understand the purpose of the <form> element for traditional form submissions with a full page reload, but in the context of ...

Select a different radio button to overwrite the currently checked one

I am facing a situation where I have two radio buttons. The default checked state is one of them, but I want to change that and make the other one checked by default instead. Here is the HTML code: <div class="gui-radio"> <input type="radio" v ...

I'm currently in the process of creating a snake game using HTML5. Can you help me identify any issues or problems that

I am experiencing an issue where nothing is appearing on the screen. Below are the contents of my index.html file: <html> <body> <canvas id="canvas" width="480" height="480" style="background-color:grey;"></canvas> <script src=" ...

What is the method for selecting the "save as" option while downloading a file?

Imagine a scenario where you click on a link like this: <a href="1.txt">Download</a> After clicking the link, a save as window will appear. Is it feasible to utilize JavaScript in order to simulate button clicks within that window? Alternativ ...

What is the best way to showcase the information stored in Firestore documents on HTML elements?

Currently in the process of designing a website to extract data from my firestore collection and exhibit each document alongside its corresponding fields. Below is the code snippet: <html> <!DOCTYPE html> <html lang="en"> <head> ...

Document Type Declaration for Framesets

Is it permissible to use regular HTML tags outside of the frameset tag if we are using frameset doctype on a page? Take a look at this code snippet; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"&g ...

Having trouble implementing a nested grid system in Bootstrap

Struggling with creating a grid layout that looks like the one in this image. I initially thought of setting up a row with 2 divided columns, then adding another row+column within each of those 2 columns to place a card inside. This is an excerpt of my c ...

displaying the description of a Wordpress category

How can I display the Wordpress category description and name separately in two different locations? I want to show just the description without including the category name or slug. Currently, I have been using the following code snippet to display only t ...

use jquery to increase margin on card upon collapse displaying

I'm currently using an accordion from a bootstrap 4 website. <div class="accordion" id="accordionExample"> <div class="card m-0"> <div class="card-header bg-white" id="headingOne"> <h5 class="mb-0"> <but ...

Having trouble understanding Responsive Frameworks such as Bootstrap?

Looking to dive into the world of responsive frameworks, but feeling overwhelmed by options like Bootstrap, Foundation, Gumby, UI Kit, and Semantic UI? You're not alone. With so many choices and comparisons out there, it's easy to get lost in the ...

"Blank Canvas: Exploring the Void in Laravel Blade Templates

This is the route that I am using Route::get('login', function(){ return View::make('admins.login'); }); In this code, I have created a admins/login.blade.php file to handle the login view. <!doctype html> <html> < ...