Clickability of links on an element is lost when it is positioned behind another element that is fixed

I can't seem to figure out why the green menu is hidden behind the white header, making its links unclickable. It's necessary for the layout of the page, but it's causing this issue.

The white header has a position: fixed; attribute. The green menu, on the other hand, has a z-index -1 in order to be stacked behind the white header.

Is there a way to make the links clickable?

Update:
I've attempted changing the z-index values to both 99 and -99 for both elements. It seems that the only way to position the green menu behind the white header is by using a negative z-index value.

Second Update:
I also tested setting opacity: .99; for the white header with no success.

https://i.sstatic.net/4LZY3.png

.header {
    margin: 32px 0 0 0;
    padding: 0;
    width: 100%;
    height: 75px;
    background-color: rgba(255,255,255,0.75);
    border-top: 2px solid rgba(55,175,75,1.00);
    border-bottom: 5px solid rgba(55,175,75,1.00);
    box-shadow: 0 5px 10px rgba(0,0,0,0.4);
    position: fixed;
    z-index: 1;
}

#menu {
    position: fixed;
    margin-top: 107px;
    min-height: 40px;
    width: 100%;
    background-color: rgba(55,175,75,1.00);
    border: 1px solid rgba(55,175,75,1.00);
    border-radius: 0;
    z-index: -1;
}

Answer №1

Assign a z-index of 2 to the element with class .header and a z-index of 1 to the element with ID #menu

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

Setting font sizes using CSS values according to the Shadow DOM root element

Summary of the problem: I am searching for a method to establish font size values based on an element inside a shadow dom relative to the shadow host, regardless of the parent element's font size within the shadow dom. I am looking for a solution sim ...

The Slim POST function is not successfully uploading data to MySQL database

I have encountered a strange issue. Despite receiving no errors or console messages, everything appears to return a 200 status successfully. I am utilizing the Slim framework to POST data into my database. When I access existing data via the URL, everythi ...

Problems with select box rendering in Internet Explorer with Materialize CSS

When using materializecss select box in Internet Explorer 9 or higher, scrolling with the mouse button is not working. You must click on the scroll bar inside the select box for it to scroll. This issue does not occur in other browsers. I have attached a s ...

With each click of the refresh button, a new email is dispatched

I'm struggling with my code as I try to create a contact form. My knowledge of php is limited, and I keep encountering issues. Every time I refresh the page, an email is sent automatically and I receive the "Confirm form resubmission" message which is ...

Difficulty in placing the logo within the navigation menu

Currently working on developing a website and encountering challenges with positioning the logo within the navigation bar. A test version of the site can be found at The logo is not centered properly in its designated space, especially in smaller browser ...

What is the best way to eliminate the background color from one span after selecting a different one?

I created a span element that changes its background color when clicked, but I want the background color to switch to the newly clicked span while removing it from the previously clicked one. Can someone help me achieve this? CSS list-sty ...

Utilize LI styling exclusively for a specific section of the website

Is it possible to style LI items with padding and bullet points only when they are inside the <div class="article-content"> element without affecting other ul/li styles on the website such as the navigation menu? Thank you for your help! .article-co ...

Styling <html:link> elements with CSS

I'm new to using struts and I'm struggling with applying my CSS styles to link tags. <html:link action="LoginLink" styleClass="loginButton"/> My goal is to add a button image to a link that directs to a login page. I've successfully ...

Profile picture placeholder with conditional logic

After extensively searching online, I was unable to find a solution on how to add a default profile picture. Here is the code snippet I used for uploading an image chosen by the user: <td><img class="image" src="image/<?php echo $contact[&apos ...

Blinking Effect of New Element in JQuery ListView

I'm attempting to implement AJAX functionality in a JQuery listview that will make flash yellow, but unfortunately I am having trouble getting it to work. Could someone provide me with some guidance? http://jsfiddle.net/zFybm/ ...

JQuery is having trouble with playing multiple sound files or causing delays with events

I've been working on a project that involves playing sounds for each letter in a list of text. However, I'm encountering an issue where only the last sound file is played instead of looping through every element. I've attempted to delay the ...

Having trouble getting @media queries to work effectively across various screen sizes

Currently, I am using Sass with Bootstrap and facing some challenges when implementing different media queries. Despite most discussions revolving around CSS problems only, I am uncertain of the source of my issue and how to effectively address it. The sty ...

The problematic max-width with srcset attribute

Here's the HTML markup I'm working with: <picture> <source srcset="img/home-page/placeholders/placeholder_2560.jpg" media="(max-width: 2560px)"> <source srcset="img/home-page/placeholders/placeh ...

Alignment of Bootstrap 5 card text and buttons

I've been diving into the BootStrap 5 Crash Course from this YouTube link: https://www.youtube.com/watch?v=4sosXZsdy-s. The final website from the tutorial can be found here: One specific part focuses on using Cards, but I'm facing an issue wher ...

How to implement multiple conditions with ng-if in HTML

I need to implement a button that is visible only for specific index numbers: <tbody data-ng-repeat="(wholesalerIndex, wholesaler) in wholesalers"> <tr> <td> <but ...

Creating a Bootstrap 4.1 dropdown submenu on hover: A step-by-step guide

Currently, I am developing a website and I am looking to implement a dropdown submenu on hover using Bootstrap 4.1. Here is the HTML code snippet I have utilized to create the hover dropdown menu: <div class="navbar-collapse text-center" id="navbarRes ...

Adjusting the color of a value in justGage requires a few simple steps to

Is it possible to modify the color and design of the text in the Value parameter of justGage after creating the gauge? My goal is to change the text color to blue with an underline to give it a link-like appearance. Appreciate your assistance. ...

How can we determine if the user is on a small device and utilizing flexbox with col-sm?

Is there a method to detect when the user is on a small device? I'm looking to adjust my navigation menu based on the size of the device, similar to the col-sm functionality. ...

Is there a reason why the Chrome browser doesn't trigger a popstate event when using the back

JavaScript: $(document).ready(function() { window.history.replaceState({some JSON}, "tittle", aHref); $(window).bind("popstate", function(){ alert("hello~"); }); }); Upon the initial loading of the www.example.com page, the above JavaScript code is ex ...

Update the contents of a neighbor div within the same parent element using jQuery

Attempting to set the range slider value within the slider parent sibling var updateRangeSlider = function() { var slider = $('.range-slider'), range = $('.range- value = $('.range-slider__value'); sli ...