When scrolling down, the overflow of the container div is clipped

Currently, I am developing an Electron application using HTML, CSS, and Javascript. In my project, there is a container div named #mainGrid that acts as a CSS grid container with 100% height to ensure the background color remains centered and covers the entire vertical space:
screenshot of initial screen
Everything functions properly until dynamically added content causes overflow, resulting in the clipping of the container div and its background when scrolling down:
screenshot of clipping issue
I captured a screenshot of DevTools highlighting the #mainGrid and displaying the same clipping problem at the bottom:
DevTools Highlighting screenshot
Upon resizing the window, the div adjusts to 100% height again. However, it should stay at 100% without needing to readjust every time. I am struggling to fix this issue and would greatly appreciate any assistance. Below is my current CSS:

html, body {
    background-color: rgb(96, 174, 238); 
    margin: 0px;  
    min-height: 100%;
    height: 100%;
    overflow: auto;
}

/*----Main grid area ----*/
#mainGrid {
    background-color: rgb(233, 233, 233);
    border-style: none groove none groove;
    margin: 0 100px 0 100px;
    min-height: 100%;
    height: 100%;
    display: grid;
    grid: 'appHeader settingsDiv'
        'products products'
        'addProdBtn grandTotals';
    align-content: start;
}

If additional code would be useful for troubleshooting, please let me know. Thank you!

edit: Here's the corresponding HTML:

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

<head>
    <link rel="stylesheet" type="text/css" href="./style/main.css">
    <title>Ultimate Quoting Tool 9000!!!</title>
</head>

<body>
        <div id="mainGrid">

            <div id="appHeader">
                <h1>Quoting Tool 9000!!!</h1>
            </div>

            <div id="settingsDiv">
                <a href="" id="settingsBtn">Settings</a>
            </div>

            <ul id="quoteList">
                <li class="prodGrid">
                    <div class="prodHead">
                        <label>Substrates:</label>
                    </div>
                   <!-- Rest of the HTML content goes here -->
                </li>
            </ul>
            <div id="addProduct">
                <a href="" id="addProductBtn">Add Product</a>
            </div>

            <div id="grandTotals">
                <!-- Grand Total calculations listed here -->
            </div>

        </div>

    <script src="./index.js"></script>
</body>

</html>

Answer №1

To enhance the appearance, try deleting the values: min-height:100%; height:100% from within the html,body tags in the CSS segment. This adjustment should produce a satisfactory outcome.

html, body {
    background-color: rgb(96, 174, 238); 
    margin: 0px;  

    overflow: auto;
}

Answer №2

Yay, problem solved! After some trial and error, I discovered that changing "height" to "min-height" on my #mainGrid did the trick. I also made sure to keep the height attribute in the html and body tags as they are the parent elements. Setting margin to 0px allowed the #mainGrid to stretch properly from top to bottom. Here's the updated CSS code:

html, body {
    background-color: rgb(96, 174, 238); 
    margin: 0px; 
    overflow: auto;
    height: 100%;
}

/*----Main grid styling ----*/
#mainGrid {
    background-color: rgb(233, 233, 233);
    border-style: none groove none groove;
    margin: 0 100px 0 100px;
    display: grid;
    grid: 'appHeader settingsDiv'
        'products products'
        'addProdBtn grandTotals';
    align-content: start;
    min-height: 100%;
}

I want to give credit to a useful thread I found while troubleshooting this issue:
Background cuts off when html and body height are set to 100%

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

Having trouble making the file system work with the AppImage created using electron-builder

I am currently using Electron Builder to compile my Electron application into an .AppImage file. I am also utilizing the fs module to write data to a .json file. However, I have encountered an issue where this function does not work when running the appima ...

Are there any APIs available through atmospherejs?

Are there any APIs available on atmospherejs for listing and searching Meteor packages? I am interested in creating an app that can search and list meteor packages. ...

Working with AngularJS: How to sort ng-options when dealing with an object

Is there a way to sort the choices in a {select} like this? <select ng-options="value as name for (value,name) in vm.options" ng-model="vm.selected"> If the object vm.options is being used and sorting by values is desired, how can it be achieved? ...

Centering bootstrap columns in a WordPress template

I am facing an issue with aligning columns in a bootstrap section within a Wordpress template that I am working on. The problem is that the columns on the second line of the row are not centered. Currently, the layout displays 4 columns in the top row and ...

Tips for disabling the source of an external iframe

Is there a way to close an iframe src with a click event from within the iframe itself? Let's suppose I have this parent HTML: <body> <script> document.write("<iframe src='default.html' id="myFrame" width=' ...

How to Display Element in Vue.js when Window.print is Triggered?

I'm wondering if it's possible to show a different message when a user tries to print my page. I currently have a 'Pay Now' button that isn't visible in the print preview. I'd like to display a text saying 'Visit www.exam ...

Steps for assigning innerHTML values to elements within a cloned div

Currently, I am setting up a search form and I require dynamically created divs to display the search results. The approach I am taking involves: Creating the necessary HTML elements. Cloning the structure for each result and updating the content of ...

The event listener $(window).on('popstate') does not function properly in Internet Explorer

$window 'popstate' event is not functioning properly in IE when using the browser back button. Here is the code snippet used to remove certain modal classes when navigating back. $(window).on('popstate', function(event) { event.pre ...

The battle of line-height versus padding for achieving vertical centering with one-lined text

One-lined text can be vertically centered using either the line-height property or by adding padding-top and padding-bottom. What are the advantages and disadvantages of each method? body { font-size: 12px; font-family: ...

What causes delays in transition for 'margin' and 'padding' in webkit browsers?

I attempted to use CSS transition effects on the margin and padding properties. The goal was to create an illusion of a larger background upon hovering. To achieve this, I increased the padding and decreased the margin correspondingly on hover, ensuring t ...

The THREE.TextureLoader() function will repeatedly load a single texture, potentially more than 20 times

An issue has been discovered with the THREE.TextureLoader() function, as it seems to load the same assets multiple times (often 20 times or more) in an unexpected and erroneous manner. The screenshot below from the browser console illustrates this behavio ...

What is the best way to choose a particular radio button from a group of radio buttons using typescript?

Is there a way to automatically select a specific radio button when an item is chosen from a dropdown menu on the webpage using a TypeScript function that is triggered by the dropdown selection? ...

Emulate a mouse click on an Angular element

I am facing a challenge where I need to execute Angular controller functions from outside of the application. Due to simplicity reasons, I am unable to make modifications directly to the Angular app itself. Ideally, the code should be able to run in the br ...

How can I update user profile details in PostgreSQL and Node.js without requiring all parameters to be sent in the request body each time?

I'm faced with a Postgres query structured like this: UPDATE farmers SET first_name=$1, last_name=$2, contact_no=$3, cooperative_name=$4 WHERE verification_id=$5 The challenge is that whenever I need to update the data, I have to send values for all ...

Using CSS and JavaScript to create a gradient-style opacity effect for smoothly fading out content

Is there a way to achieve a gradient fade effect on the opacity of an iframe and its content? To provide an illustration, think of the bottom of the notification centre in Mountain Lion or iOS. The concept involves having the content within an iframe grad ...

What is the best way to manage several asynchronous requests concurrently?

Can anyone recommend some valuable resources or books that explain how to effectively manage multiple asynchronous requests? Consider the code snippet below: Payment.createToken = function(data) { var data = data; apiCall("POST", "api/createToke ...

Press the designated button located within a table's td element to retrieve the values of adjacent td elements

I need to implement a functionality where clicking a button within a <td> element will retrieve the values of other <td> elements within the same row (<tr>). Here is the current implementation: $(document).ready(function(){ ...

import an external JavaScript file in an HTML document

Looking to load a .js file from a simple HTML file? If you have these files in the same folder: start.js var http = require('http'); var fs = require('fs'); http.createServer(function (req, response) { fs.readFile('index.htm ...

The final element that fractures all its sibling elements positioned absolutely

I am experiencing an issue with a container div that contains 5 absolutely positioned images. When I specify the last image as absolutely positioned, all other images lose their positioning and stack at the top. The container itself is relatively position ...

Widget launching in a fresh window

Attempting to have this widget open in a new tab by inserting "target="_blank" into the widget code: However, it seems to be unsuccessful. Any helpful tips or suggestions would be greatly welcomed. Thank you! ...