Eliminating the issue of double scroll bars that overlap each other

Currently, I am developing a website that utilizes javascript, html, and css. One of the pages on the site displays all users as list items within an unordered list, which is nested inside two separate div elements. When accessing the page on my phone, both of these divs are generating scroll bars; however, when viewed on a computer, there is no issue with scrolling. My goal is to make this website responsive and mobile-friendly, but the presence of these two scroll bars is hindering usability on a phone.

Below, you will find the code for the page. Please be aware that there may be some unused CSS properties, so it's best to overlook those. The unordered list with the id "supervisee-list" dynamically populates with all the users' information.

Here is the HTML code for the page (note that the Handlebars view engine is being utilized):

<link rel="stylesheet" href="../css/admin-managesupers.css">
<div id="background">
    {{> navbar}}
    <div id="employee-manage" class="hidden-div">
        <button id="back-btn"><span id="back-sign">&lt;</span> Back</button>
        <h1 id="employee-name">Carsdan Dvorachek</h1>
        <h2 id="supervisor-title">Supervisor Status</h2>
        <select name="supervisor-status" id="supervisor-status-select"></select>
        <h2 id="supervisor-title">Supervising</h2>
        <ul id="supervisee-list">
        </ul>
    </div>
</div>
<script src="../js/admin-managesupers.js"></script>

Here is the corresponding CSS code:

#background {
    width: 100vw;
    height: 100vh;
    background-color: gainsboro;
    margin: 0;
    overflow: scroll;
}

.hidden-div {
    display: none;
}

#employee-manage, #employee-select {
    width: 90%;
    height: auto;
    max-width: 600px;
    background-color: white;
    margin: 0 auto;
    text-align: center;
    box-shadow: 0 0 15px grey;
    padding-bottom: 20px;
    overflow: hidden;
    position: relative;
}

#select-employee-title {
    padding-top: 20px;
}

li {
    border: 1px solid;
    list-style: none;
    position: relative;
    text-align: left;
    padding: 10px 15px;
    margin: 10px auto;
    max-width: 80%;
}

li:hover {
    background-color: gainsboro;
}

.mark-super {
    position: absolute;
    right: 10px;
    text-align: right;
}

#back-btn {
    position: absolute;
    left: 10px;
    top: 10px;
    background: none;
    border: solid 2.5px rgb(9, 139, 175);
    margin: 20px;
    color: rgb(9, 139, 175);
    font-size: 100%;
    padding: 5px;;
}

#back-sign {
    font-size: 110%;
}

#employee-name {
    padding-top: 60px;
}

.supervisee, .supervisee > span {
    color: green;
}

.othersupervisee, .othersupervisee > span {
    color: grey;
    border-color: grey;
}

#supervisee-list, #employee-list {
    padding-left: 0;
}

@media screen and (max-width: 580px) {
    .mark-super {
        position: static;
        display: block;
    }
}

Despite experimenting with various combinations of overflow: hidden and overflow: scroll on different elements, I have not found a solution to eliminate the multiple scroll bars causing issues on mobile devices.

Answer №1

After running a test on the code you provided, I found that simply removing the "overflow" property completely eliminated the duplicate scroll bar issue. Additionally, it is important to use caution when utilizing the following:

#background {
   width: 100vw;
   height: 100vh;

In my testing across multiple browsers, this resulted in an unnecessary browser scroll bar appearing. It may be more effective to utilize percentages instead of viewport units.

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 most effective method for determining the distance between two UK Postcodes?

Can you suggest a reliable method for calculating the distance between two UK postcodes in order to determine if they are within range? I do not intend to display a map, but instead provide a list of results for valid locations. For example, showing loca ...

Can the submit ID value be utilized in PHP?

name="submit" functions as expected. if(isset($_POST["submit"])) <input type="submit" ID="asdf" name="submit" value="Save" class="ui blue mini button"> I want to change it to use ...

Leveraging BeautifulSoup for extracting information from HTML documents

I'm working on a project to calculate the distance between Voyager 1 and Earth. NASA has detailed information available on their website at this link: ... I've been struggling to access the data within the specified div element. Here's the c ...

Arranging checkboxes in harmony with accompanying text using HTML and CSS

Here is the layout I have created using react JS. https://i.sstatic.net/UHagO.png Below is the code snippet used to generate each checkbox: const CheckBoxItem = ({ Label, item, paramField, change }) => { return ( <div className="Sea ...

What is the best way to overlay my slider with a div containing content?

In the hero section of my website, there is a slider with 3 slides. I am looking to add a div element that will display content over these slides at all times, regardless of which slide is currently showing. ...

HTML and JavaScript: Struggling to include multiple parameters in onclick event even after escaping quotes

I am struggling to correctly append an HTML div with multiple parameters in the onclick function. Despite using escaped quotes, the rendered HTML is not displaying as intended. Here is the original HTML code: $("#city-list").append("<div class='u ...

Setting a bookmark feature in HTML using localStorage: A step-by-step guide

I'm working on a simple code that captures the text content of a dynamically updated <h1> element and stores it as a "bookmark" in localStorage. I want to enable users to save or delete the bookmark by clicking a button. Below is a basic version ...

Parent whose height is less than that of the child element

I'm working on creating a side menu similar to the one on this website. However, I'm facing an issue with the height of the #parent list element. I want it to match the exact same height as its content (the #child span - check out this jsfiddle). ...

Choose the appropriate button when two buttons have the identical class

Here is the HTML code I am working with: <a class="action_btn recommend_btn" act="recommend" href="recommend.php"> Recommend </a> Below is my jQuery implementation: $(".action_btn").click(function() { }); However, a problem arises beca ...

MySQL unable to access information entered into form

After creating a new log in / register template using CSS3 and HTML, I now have a more visually appealing form compared to the basic one I had before. To achieve this look, I referenced the following tutorial: http://www.script-tutorials.com/css 3-modal-po ...

Here is a guide on updating HTML table values in Node.js using Socket.IO

I successfully set up socket io communication between my Node.js backend and HTML frontend. After starting the Node.js server, I use the following code to emit the data 'dRealValue' to the client side: socket.emit ('last0', dRealValue) ...

Implementing the rotation of an element using 'Transform: rotate' upon loading a webpage with the help of Jquery, Javascript, and

A div element designed to showcase a speedometer; <div class="outer"> <div class="needle" ></div> </div> The speedometer animates smoothly on hover; .outer:hover .needle { transform: rotate(313deg); transform-origin: ce ...

What's the best way to place my image inside a Bootstrap Accordion so that it is housed within the accordion-item?

I've been facing an issue with a Bootstrap Accordion. Everything works fine, except when I try to insert an image <img src="https://placehold.co/600x400" class="img-fluid" /> into an accordion-item <div class="accord ...

Creating a designed pattern for a textbox: Let's get creative with your text

How can I create a Textbox that only allows numeric values or the letter 'A'? <input type="text" id="txt" name="txt" pattern="^[0-9][A]*$" title="Allow numeric value or only Letter 'A'&quo ...

At what point are DOMs erased from memory?

Recently, I've been working on an application that involves continuous creation and removal of DOM elements. One thing I noticed is that the process memory for the browser tab keeps increasing even though the javascript heap memory remains steady. To ...

Tips for executing a Python function from JavaScript, receiving input from an HTML text box

Currently, I am facing an issue with passing input from an HTML text box to a JavaScript variable. Once the input is stored in the JavaScript variable, it needs to be passed to a Python function for execution. Can someone provide assistance with this pro ...

Creating a Tree Checkbox using jQuery without relying on pre-made plugins

The data structure provided appears to be hierarchical, but I am unsure if it follows the Adjacency list or Nested List model. Regardless, it is relatively simple to gather this hierarchical data. For instance, to retrieve the entire tree, you can use: SE ...

Confirm the Text Box with JavaScript

I'm struggling with validating the textbox on my login Xhtml. Once I finally cracked the code, I encountered an issue with the 'container' class in the section. How can I properly write the code and successfully validate the textbox? <h ...

Define the content and appearance of the TD element located at the x (column) and y (row) coordinates within a table

In my database, I have stored the row and column as X and Y coordinates. Is there a straightforward way to write code that can update the text in a specific td element within a table? Here is what I attempted: $('#sTab tr:eq('racks[i].punkt.y&a ...

What could be causing the absence of the box within the div element?

I am still learning the ropes of javascript, CSS, HTML and programming in general. Despite being a beginner, I have managed to grasp the basics of simple HTML and CSS. I had successfully created a nested div structure before, but suddenly the inner div is ...