When the main viewport is scrollable, the div element will not have scrolling capability

I designed a three-column layout for my web application, with the first two columns serving as the menu and submenu, and the third column acting as the main viewport. However, I encountered an issue where the second column (div) does not scroll when the main viewport is scrolling, even though it displays a scrollbar. Can anyone help me identify what I might be doing wrong?

<div id="container">

<div id="top" class="clearfix">
    Header
</div>

<div id="container_menu">
    <ul id="menu">
        <li>Content for the Menu goes here</li>
    </ul>
</div>

<div id="container_submenu">
    <div id="submenu">
    Submenu content goes here
        <strong>Why is this div not scrolling properly? (It shows a scrollbar but doesn't scroll)</strong><br />
        Placeholder text<br />
    </div>
</div>

<div id="main">
    Placeholder text<br />
</div>

CSS

* {
    margin: 0;
    padding: 0;
}
.clearfix:before, .clearfix:after {
    content:"";
    display:table;
}
.clearfix:after {
    clear:both;
}
.clearfix {
    zoom:1;
    /* For IE 6/7 (trigger hasLayout) */
}
body, td, th {
}
body {
    background: #fff;
}
div#container {
    min-width: 800px;
    /*TODO*/
    width: 100%;
}
div#top {
    width: 100%;
    height: 50px;
    background: #000;
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 5;
}
/* MENU */
 div#container_menu {
    background: #666;
    position: fixed;
    left: 0;
    top: 0;
    width: 180px;
    margin-right: -180px;
    height: 100%;
}
ul#menu {
    margin-top: 50px;
}
/* SUBMENU */
 div#container_submenu {
    z-index: -1;
    background: #ebeef5;
    color: #999;
    position: fixed;
    left: 180px;
    top: 0;
    width: 250px;
    height: 100%;
    margin-right: -250px;
    height: 100%;
    overflow: scroll;
}
div#submenu {
    margin-top: 50px;
}
div#main {
    margin-left:430px;
    margin-top: 50px;
}

View JS Fiddle with CSS

Answer №1

The z-index value of div#container_submenu is currently set to -1. This causes the div to be positioned below the transparent #container div, making it visible but not clickable or targetable. To resolve this issue, adjust the z-index of div#container_submenu to 0.

Answer №2

The visibility of the content is blocked by the #main division. To fix this, simply eliminate the z-index: -1. Check out an example here: http://jsfiddle.net/zephod/4xp2jj3a/

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

Design a custom icon for uploading multiple files

Looking to create a bootstrap-4 icon for multi-file upload. I've got the code reference for single file upload, but now I need to know how to create an icon for multi file upload. <!DOCTYPE html> <html> <head> & ...

What could be the reason for the recurring presence of duplicate <a> tags in my

I've implemented the bootstrap "pager" feature from the pagination section. Here is how I'm using PHP to generate the HTML code for it: echo "<ul class='pager'>"; echo ($total > $lim) ? "<li class='previous'>" ...

The animation will not scroll down with the div

Having some trouble getting this div to slide down smoothly when the button is clicked. The animation seems to glitch whenever the div opens or closes. I've attempted adding position:relative and overflow:hidden, but it doesn't seem to be doing ...

I have attempted to utilize Bootstrap by downloading it locally, but unfortunately, it is not functioning as

I'm facing an issue with Bootstrap while running it locally - it's not working. However, when I use the CDN link, it works perfectly fine. Can someone assist me in resolving this problem? <!DOCTYPE html> <html lang="en"> < ...

What steps should I take to modify the appearance of the following?

I am currently working on a calculator project and I would like to change its styling. The color schemes are not specified in the CSS for simplicity's sake. This is how it looks now This is how I want it to look .button { text-align ...

Building a HTML table using PHP

My goal is to generate a dynamic table using data from mysql. I am trying to create the table layout as shown in 'demo1', but I am facing challenges with the formatting, similar to what is depicted in 'demo'. The query and values are co ...

Creating an email-friendly button in Outlook without using images by styling a hyperlink with padding

Presenting a basic HTML code snippet - https://jsfiddle.net/mark69_fnd/6g0L0jwc/ <body style="background-color: white; font: normal 14px Verdana"> Hello <p></p> <a style=" font: bold 11px; text-decoration: none; background-color ...

Scrollspy active class in Bootstrap 4.0.0-beta.2 fails to update with scroll movement on webpage

I've been working on creating my own personal landing page using HTML, consisting of three sections. I have successfully implemented the functionality where these sections are reachable through links on a navigation bar. However, I encountered an issu ...

Div content with a unique angle

I need to create a website with slanted div elements that must meet the following criteria: The sections should have a height of approximately 400px when displayed side by side, and about 800px when they stack vertically. It would be ideal if this could ...

Placing a collection of <a> anchor tags inside a div and making them float

I've been experimenting with building a website from scratch, opting for a simple and blocky design. I placed the navigation at the top of the page in an unordered list format containing <a> elements within list tags, all enclosed within a <n ...

How to alternate the display of a single li element in React?

I am looking to swap the colors of the active element in my project. Currently, both elements change style when clicked. How can I resolve this? Thanks! function Language() { const [isStyled, setIsStyled] = useState(false); const toggleStyle = ...

Incorporating a calendar icon within an input field: Step-by-step instructions

Could anyone help me figure out how to insert a Font Awesome icon into the textbox within daterangepicker? Right now, all I see is this: https://i.sstatic.net/7LLmj.png However, I want it to look like this: https://i.sstatic.net/2UyjH.png Here's my ...

What is causing the content on my webpage to not fill the entire width of the page?

I've encountered an issue with the content on one of my pages not expanding to the full width of the page. Despite placing everything inside a container and setting the max-width of the container to 1500px, the content still doesn't extend all th ...

Angular ng-repeat can sometimes lead to annoying flickering on the webpage

I have a code snippet that displays a list of thumbnails: <div class ="channel" ng-repeat ="channel in UIModel.channels" ng-class ="{evenchannel: ($index % 2) == 0, oddchannel: ($index % 2) == 1}"> <img class="channel-img" ng-src ="da ...

What could be the reason my div is not displaying correctly?

I am currently developing a game using HTML, CSS, and jQuery. The game will involve falling blocks that the player needs to avoid. However, I am facing an issue with my jQuery implementation. When selecting a theme (only the dark theme is currently functi ...

Utilize flexbox to achieve center left alignment of elements within a DIV container

I've encountered a puzzling issue with my inherited markup. The width is defined on the outermost div and then inherited by each child div, creating a dynamic width scenario. The challenge I face is aligning the pink wrapper div to match the exact wi ...

Placing a video as the background of a div element and ensuring the text appears in the

I'm facing a challenge with setting my text background as a video. Despite my efforts, the text remains hidden behind the video and doesn't come to the front. Additionally, I'm encountering an issue where the video background does not adapt ...

Tips for implementing a sliding list feature with next and previous buttons:

Currently, I am utilizing a list attribute to display thumbnail images of a YouTube-generated playlist (gdata feed). However, my goal is to enclose the list within a div container and implement next and previous buttons to slide through the playlist images ...

How can we pass on the width from an image to its parent or grandparent element using CSS?

Creating a cohesive image gallery with captioned images of different aspect ratios is my goal. To maintain consistency, I desire the browser to display each image at the same height while preserving its original aspect ratio by adjusting the width accordin ...

In certain instances, content spills beyond the boundaries of a div element in Chrome 43

In my design, I have a purple block that contains text of varying lengths. The block is responsive and its width is set in percentage. Some users using Chrome (v43.0.2357.65) on Windows XP are experiencing issues where the text overflows beyond the edge o ...