Whole page scrolling instead of just inner div scrolling

Once again, I find myself tinkering with CSS...

In the current setup, the map container is scrolling on its own, separate from the rest of the content within the container. How can I enable the entire page to scroll when additional content is added to the content section?

I have experimented with the overflow attribute but haven't had much success...

Note for future reference:

        body {
            background:#000000;
            margin:0;
            padding:0;
            overflow:scroll;
            overflow-x:hidden;
        }

        #container{
            position: relative;
            height: 100%;
            width: 950px;;
            background: yellow;
            margin-left:auto;
            margin-right:auto;
            overflow:auto;
        }

        #map {
            position:absolute;
            top:80px;
            bottom:0;
            left:0;
            right:0;
            background:#fff;
            overflow:auto;
            overflow-x:hidden;
        }

        #header {
            height:80px;
            width:900px;
            background:#333;
            margin:0;
            padding:0;
        }
        #header h1 {
            color:#fff;
            margin:0;
            padding:0;
        }

        #leftgradient {
            width:50px;
            height:80px;
            float:left;
            background:#096;
            background: -webkit-gradient(linear, left top, right top, from(#000000), to(#333333));
        }

        #rightgradient {
            width:50px;
            height:80px;
            float:right;
            background:#096;
            background: -webkit-gradient(linear, left top, right top, from(#333333), to(#000000));
        }

        #toppanel {
            background:#179AE8;
            width:950px;
            height:50px;
        }

        #leftpanel {
            background:#179AE8;
            width:100px;
            height:250px;
            float:left;
        }

        #content {
            background:#099;
            width:850px;
            margin-left:100px;
        }



<div id="container">
    <div id="leftgradient"></div>
    <div id="rightgradient"></div>
    <div id="header">
        <header>    
            <h1>
                Heading
            </h1>
        </header>
    </div>

    <div id="map">
        <div id="toppanel">
            top
        </div>
        <div id="leftpanel">
            lefty
        </div>
        <div id="content">
            Lots of text!!
        </div>
    </div>
</div>

Answer №1

If my understanding is correct, the solution involves stripping away a plethora of CSS declarations:

  • For body, delete: overflow: hidden.
  • For #container, eliminate: height: 100%, overflow: auto, position: relative.
  • Regarding #map, get rid of:
    • position: absolute, left: 0, bottom: 0, right: 0, top: 80px
    • overflow-x: hidden, overflow-y: auto.

With these changes, the page should be scrollable (tested in Firefox only).

However, removing all these elements may have disrupted certain functions on your site. Please inform me if anything is missing, and we can explore alternative solutions to restore that lost functionality.


To address the issue mentioned in the comments, include the following:

  • html, body { height: 100% }
  • For #container, add min-height: 100%.

This modification will reveal the yellow background peeking through on #container. To resolve this, consider changing the yellow color to white and applying a background image depicted below:


(save and utilize it)

In #container:

background: #fff url(https://i.sstatic.net/q1Sp1.png) repeat-y

Furthermore, remove the white background-color from #map.

Answer №2

Try out this CSS code: overflow: scroll;
:) let's see how that works

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

What is the best way to set up pagination for my table?

I need assistance with implementing a searching functionality for my table using pagination. I believe JQuery will be necessary for this task. Can anyone recommend tutorials that may be helpful? My project is based on C# and MVC, so those resources could a ...

Understanding AngularJS and how to effectively pass parameters is essential for developers looking

Can anyone help me figure out how to properly pass the html element through my function while using AngularJS? It seems like this method works without AngularJS, but I'm having trouble with the "this" keyword getting confused. Does anyone know how I c ...

Mystery factor triggering the appearance of scrollbar as the window is resized to a specific width threshold

I'm facing a rather peculiar problem. I'm currently in the process of creating a webpage tailored for an iPhone screen resolution of: width: 640; height: 960; However, there seems to be a mysterious hidden element that is extending the width of ...

Difficulty encountered with PHP form insertion action

I am uncertain about where the errors might be occurring. I have attempted to inspect MySQL, but it seems that nothing is being inserted into my database. To begin with, here is a snippet of my HTML code: <form action="registerAction" method="POST"> ...

What steps can I take to troubleshoot the 'Uncaught DOMException: failed to execute add on DOMTokenList' error?

I am looking to create media icons <div class="contact"> <span> <i class="fa fa-phone"></i> </span> <span> <i class="fa fa-facebook"></i> </spa ...

Perform validation on input by monitoring checkbox changes in Angular 4

I am currently working on a project where I need to loop through an array of key values in order to create a list of checkboxes, each accompanied by a disabled input field as a sibling. The requirement is that upon checking a checkbox, the corresponding in ...

Concealing forms within an Angular 5 application

I'm currently working on displaying the terms of use on the initial screen along with two buttons. If the user clicks the accept button, they will be directed to the authentication form. However, if they click refuse, the "Refused Terms" screen will a ...

Update the page with AJAX-loaded content

I am currently utilizing a .load() script to update the content on a webpage in order to navigate through the site. This is resulting in URLs such as: www.123.com/front/#index www.123.com/front/#about www.123.com/front/#contact However, I am encountering ...

What steps can be taken to enhance the responsiveness of this Bootstrap 4 code?

I've been trying to make this code more responsive, but I haven't found a suitable solution yet. When the browser window shrinks to mobile sizes, the list becomes too narrow and the picture/video items on the right end up small and aesthetically ...

What is the best way to enable a DOM element's height to be resized?

I have a widget displayed in the corner of my browser that I would like to make resizable by dragging the header upwards to increase its height. The widget's position remains fixed with its bottom, left, and right properties unchanged, but I need the ...

The content of the HTML request may not always be displayed exactly as it appears in the browser

I've been trying to extract comments from a website using Python and urllib. Although I am successful in obtaining the HTML, I noticed that the comment section is missing. Here's what my Python code retrieves: <div data-bv-product-id="681012 ...

Top and bottom fieldset legends in Bootstrap 4

Looking for suggestions on how to include legend text on the bottom border in bootstrap 4. I attempted to use position and margin, but it didn't work. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.mi ...

Extracting data from website tables

I've been attempting to retrieve salary information for CSU employees from a specific webpage (). Despite my efforts with the urllib2 and requests libraries, I have not been successful in extracting the table data from the webpage. My suspicion is tha ...

Using V-for to iterate over a multi-dimensional array

As I venture into the world of vue.js, I find myself faced with the challenge of populating nested select elements using v-for. Despite scouring through various resources on this topic, I have been unable to determine a solution that fits my particular sce ...

Is the use of !important included in Bootstrap 4?

Even though I've positioned the style.css file after Bootstrap, it still isn't working. Upon inspection, I noticed that... https://i.sstatic.net/ay621.png How can I solve this issue? .bg-info{ background-color: #17a2b8 !important; } ...

On iPhones, the links display as oversized blank containers

Recently, a client who switched from an Android phone to an iPhone reached out to me with a complaint. She mentioned that the links on her website, which I built for her, appear as large empty boxes. You can view her website here. To illustrate the issue ...

Switch the CSS class with an HTML tag

Can someone help me transform this code snippet with Python 3 and Beautiful Soup? <span class="ld-nowrap"> 20th century’s </span> I need to convert it to: <em> 20th century’s </em> Any suggestions on how to achieve t ...

Trouble with the x-cloak attribute in alpine.js

Experience with TailwindCSS and AlpineJS in my current project has brought to my attention a slight issue with the header dropdowns flashing open momentarily when the login page loads. I attempted to use x-cloak to address this, but encountered some diffic ...

Lines are showing up on the screen, but their origin within the html or css remains a

While creating my website, I encountered a minor issue. Some elements like div or text element are showing lines when hovered over with the mouse, but they disappear once clicked elsewhere. Surprisingly, there is no border defined for them. I am stuck at ...

How can I effectively make properties accessible in my template to facilitate form validation in Angular?

Scenario: I'm facing a situation in my Angular project where I have a LoginFormComponent. This component has a form with two properties: email and password. My goal is to create properties within this component that can be accessed in the template. Th ...