Z-index behaving abnormally

I've been working on developing a website and one of the key features I'm trying to implement is a slideout menu that slides horizontally when the mouse hovers over it. To make development easier, I initially set the menu to be fully extended by default.

Here's an example of what I'm aiming for:

|--------------|_____________
|Menu 1       >|Menu 1 item 1|
|Menu 2       .|Menu 1 item 2|
|Menu 3       .|Menu 1 item 3|
|______________|_____________|

This is the code I have so far:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
@charset "utf-8";
/* CSS Document */

#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    background: #151515;
    width: 250px;
    height: 100%;
    z-index: 2;
    overflow-x: hidden;
    overflow-y: hidden;
    display: block;
    transition: 0.5s;

}

#sidebarInfo{
    margin: 0px,5px,10px,5px;
    color: #7E7E7E;
    width: 100%;
    height: 50px;
    position: relative;
    font-family: allerta, sans-serif;
    font-size: 9.5px;
    top: 70%;
    align-content: center;
    display:flex;
    justify-content:center;
    align-items:center;
}

.sidebarLi{
    position: relative;
    margin: 10px;
    font-size: 28px;
    color: aliceblue;
    width: 100%;
    font-family: allerta, sans-serif;
}

.slideMenu{
    position:relative;
    transition:0.4s;

}
.menuItem{
    position:relative;
    transition: 0.4s;
    width: 150px;
    height: 30px;
    overflow-x: visible;
    overflow-y: visible;
    left: 180px;
    z-index: 0;
    color: #000000;
    background: #FFFFFF;
}

</style>

<title>Caduceus Technologies</title>

</head>

<body>
    <div id="sidebar">
        <div class="sidebarLi">
            &nbsp;•&nbsp;Home
        </div>
        <div class="sidebarLi">
            <div class="slideMenu">
                &nbsp;•&nbsp;Projects
                <div class="menuItem">
                    menuItem1
                </div>
            </div>
        </div>
        <div class="sidebarLi">
            &nbsp;•&nbsp;Resume
        </div>
        <div class="sidebarLi">
            &nbsp;•&nbsp;Contact
        </div>
    </div>
    <div style="background:#1D1D1D; position: relative; width:1000px; height: 1000px;">
        Lorem
    </div>
</body>
</html>

But despite setting the Z value correctly, when viewing the document you'll notice that 'menu Item 1' is not fully displayed. What could be causing this issue?

Answer №1

menuItem1 appears cut off because the sidebar div enclosing it has a fixed width and is set to overflow: hidden, therefore hiding any content that extends beyond its boundaries (including menuItem1).

If you remove the overflow: hidden property, menuItem1 will be visible but may extend outside the container's borders.

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

Learn how to save user input from form fields and text areas into JSON format using Angular

Is there a way to add comments using Angular when a user clicks on a button? Currently, whenever text is entered in the input field or textarea, it disappears and an empty block without any name, country, and comments is displayed. The entered text should ...

Content refuses to show up on my social networking website project when Ajax is employed

I've been working on a Social Media website for a major project, and I recently implemented Ajax to load posts. However, I'm facing an issue where the content is not displaying on the index page after implementation. My goal is to load 10 posts a ...

Issues with CSS Min-Height in Various Web Browsers

Lately, I've been working on a website and trying to create a border that surrounds all my content and extends the full length of the page. The #Container div is supposed to expand to fill the entire page. I've tried using min-height:100%; in my ...

The Material-UI table spills out of its designated container

My material-ui table is resizing and scrolling horizontally without issue, but the table element and its contents are overflowing off the right side of the page. Check out this gif to see the behavior: https://i.stack.imgur.com/lXuHj.jpg Additionally, her ...

Having trouble with my phonegap app not allowing me to open any

I've just embarked on creating my first phonegap application using an HTML5 mobile website template. After deploying it, I noticed that the external links are not working within the app. Clicking on a link doesn't seem to do anything. To addres ...

How to Align Two HTML Forms Using CSS

I've been experimenting with various methods, but I'm still unable to achieve the desired outcome. Currently, my setup looks like this: However, what I really want is something more like this: The layout consists of a #Container div that conta ...

Padding for the initial element in a carousel display

I am currently working on implementing owl carousel with stage padding. My goal is to use the carousel with loop:false, and have the first item displayed without left padding, while maintaining consistent padding for both items on the left and right after ...

How can I make this div appear on the screen?

I have recently encountered an issue with a navbar on my webpage. Despite adding all the necessary links, one of them mysteriously disappears from view. It seems to be present when inspected in the console, but it just won't display on the front end. ...

What steps can I take to ensure a JavaScript loading image is displayed until the entire page has finished loading?

Looking to implement a JavaScript loading image that displays until the page has fully loaded? I'm currently developing an online antivirus scanner and in need of help. I am trying to set up JavaScript to show a loading image while a file is being up ...

Tips for adding a red dot at the top-right corner of a necessary HTML input label, similar to an asterisk

Is there a way to replace the asterisk with a dot in an HTML label for a required input? The dot should be positioned in the top-right corner similar to where the asterisk would typically be. ...

Tips for adjusting the height of a selection box in jQuery Mobile

I am trying to make the select box height the same as the label (模板分類:). <select id="TamplateClass" style="height:1.5em">...</select> you can use CSS #TamplateClass{height:1.5em;} However, no matter what I try, the results are all th ...

The alignment of elements on the right and left sides is not functioning as intended

I've been facing an issue with the alignment of my floats on my brand new website www.unicmedia.nl/case/oranje. Surprisingly, they seem to work fine in IE this time, but Firefox and Chrome are completely out of sync. Despite trying numerous solutions ...

error being triggered due to relative positioning

On my webpage, I have a set of buttons located at the bottom. When I first open the page, all the buttons are displayed properly. However, sometimes the first three buttons become hidden mysteriously and the layout changes. I am puzzled as to what could be ...

Difficulty displaying SVG in Opera browser when using the Raphael JS library

Currently, I am experimenting with Raphael JS to create visually appealing SVG graphics on a webpage. You can view my progress at . Most browsers display the graphics properly except for Opera 11. In Opera, the graphics fail to render when clicking on any ...

streaming an HTML5 video directly from memory source

After retrieving multiple encrypted data using ajax queries and performing necessary manipulations to turn them into a valid video, I find myself at a standstill. The binary of the video is now stored in memory, but I am unsure how to display it. To confi ...

Slider that allows range selection after midday

Currently facing a dilemma using the noUiSlider plugin. I have set up a time range picker starting from 6 am to 6 am the following day. Everything works smoothly until it reaches 23:59, but I need it to display 1:00, 2:00 instead of 25:00, 26:00 for the ...

Having trouble getting the overflow scrollbar to work properly?

I recently created a Whiteboard using Vue. The Whiteboard consists of an SVG element where I can add other SVG elements like paths to it. In order to enable scrolling within the SVG, I came across this example which seemed quite helpful. Check out the exa ...

Arranging two list items (<li>) side by side in HTML code

I am currently designing a form with a side navigation bar that will display around 15-20 elements. Each element is represented by an <li> containing a link to open a modal when clicked. This is the current structure of my code: <div id="sidebar ...

Why is the image cut in half on mobile devices but displaying correctly on computer screens? Could it be an issue with

There seems to be an issue on mobile screens that does not occur on computer screens. When the user clicks on the image, it disappears, and when they click another button, it reappears. However, there is a problem with how the image appears - it is cut off ...

Include new items in the li tag using JavaScript

Hello, I am looking to dynamically add elements to an LI element when a link is clicked. I have successfully added elements to a DIV using the following code snippet: I came across a similar question on Which "href" value should I use for JavaScript links ...