z-index in CSS causes links to conflict

I am currently working on a project that requires an image to be displayed prominently on the website along with some links positioned behind it. However, I'm facing an issue where I can't click on the links after implementing z-indexes to layer them correctly. I have attempted adjusting the index values of the links to be higher than those of the image, but unfortunately, I still can't interact with the links...

Here is the HTML code:

<!DOCTYPE html>
<html lang="">

<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<meta name="Author" content="" />
<link rel="stylesheet" type="text/css" href="styles.css">
</head>

<body>

<div class="container">

    <div class="milhoes">
        <div class="milhoes_img_cont">
            <img class="milhoes_img" src="milhoes.png" alt="">
        </div>

        <div class="left-menu">
            <div class="menu-item" id="menu-primeiro">
                <a href="">CARTAZ</a>
            </div>
            <div class="menu-item" id="menu-segundo">
                <a href="">INFO</a>
            </div>
            <div class="menu-item" id="menu-terceiro">
                <a href="">CONTACTOS</a>
            </div>
        </div>

            <div class="right-menu">
                <div class="menu-item" id="menu-primeiro-r">
                    <a href="">BILHETES</a>
                </div>
                <div class="menu-item" id="menu-segundo-r">
                    <a href="">LOJA</a>
                </div>
                <div class="menu-item" id="menu-terceiro-r">
                    <a href="">FESTIVAL</a>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

CSS styling applied to the elements:

@media screen and (max-width: 1028px) {
.container {
    background-color: pink;
}
}

@media screen and (max-width: 1024px) {
.container {
    background-color: blue;
}
}

@media screen and (max-width: 800px) {
.container {
    background-color: red;
}
}

@media screen and (max-width: 640px) {
.container {
    background-color: green;
}
}

@media screen and (max-width: 320px) {
.container {
    background-color: yellow;
}
}


html,
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}

.container {
width: 100%;
height: 100%;
background-color: black;
background-image: url(palco.jpg);
background-size: cover;
position: absolute;
top: 0;
left: 0;
z-index: -5;
}

.milhoes {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}

.menu-item {
height: 45px;
margin-bottom: 100px;
z-index: 100;
}

.milhoes_img {
height: 100%;
}

.milhoes_img_cont {
width: 100%;
height: 90%;
position: fixed;
z-index: 1;
margin-top: 2%;
}

.milhoes_img_cont img {
margin-left: auto;
margin-right: auto;
display: block;
}

.left-menu {
top: 10%;
left: 20%;
position: fixed;
z-index: 0;
}



#menu-primeiro {
-ms-transform: rotate(7deg);
-moz-transform: rotate(7deg);
-webkit-transform: rotate(7deg);
transform: rotate(7deg);
-webkit-backface-visibility: hidden;
background-color: #e41e25;
width: 300px;
margin-top: 50px;

}

#menu-segundo {
-ms-transform: rotate(-15deg);
-moz-transform: rotate(-15deg);
-webkit-transform: rotate(-15deg);
transform: rotate(-15deg);
-webkit-backface-visibility: hidden;
margin-left: 20px;
background-color: #e41e25;
width: 400px;
margin-top: 150px;

}

#menu-terceiro {
-ms-transform: rotate(-2deg);
-moz-transform: rotate(-2deg);
-webkit-transform: rotate(-2deg);
transform: rotate(-2deg);
-webkit-backface-visibility: hidden;
margin-left: 40px;
background-color: #5bc7d2;
width: 350px;
margin-top: 150px;
}


.right-menu {
top: 10%;
right: 10%;
position: fixed;
width: auto;
text-align: right;
z-index: 0;
}


#menu-primeiro-r {
-ms-transform: rotate(-12deg);
-moz-transform: rotate(-12deg);
-webkit-transform: rotate(-12deg);
transform: rotate(-12deg);
-webkit-backface-visibility: hidden;
background-color: #5bc7d2;
width: 350px;
margin-top: 50px;
margin-left: 100px;

}

#menu-segundo-r {
-ms-transform: rotate(2deg);
-moz-transform: rotate(2deg);
-webkit-transform: rotate(2deg);
transform: rotate(2deg);
-webkit-backface-visibility: hidden;
background-color: #e41e25;
width: 400px;
margin-top: 150px;
margin-left: 60px;


}

#menu-terceiro-r {
-ms-transform: rotate(15deg);
-moz-transform: rotate(15deg);
-webkit-transform: rotate(15deg);
transform: rotate(15deg);
-webkit-backface-visibility: hidden;
background-color: #5bc7d2;
width: 350px;
margin-top: 120px;
margin-right: 160px;

}

.right-menu a{
z-index: 120;
}

.menu-item a{
color: white;
line-height: 40px;
text-decoration: none;
font-size: 1.5em;
padding: 0 15px 0 15px;
font-family: Roboto, Arial, sans-serif;
}

For further reference, you can view this Pen

Answer №1

Consider using pointer-events: none; as a solution for interacting with overlapping elements.

Answer №2

After removing all the z-indexes, everything appears to be functioning correctly now.

Unless I've overlooked something.

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

Obtaining table data and HTML elements using the correct code - Selenium and Python

I've been attempting to extract the ticker symbol, stock name, price, sector, and market cap columns from this website. I'm facing challenges in identifying the correct HTML elements using the appropriate code. Although I've used Selector Ga ...

Automating the process of choosing a dropdown option on a website with a Python script

When navigating the website, I found that I needed to choose a specific time duration from a drop-down menu, as shown in the image. My goal is to automate this process using a Python script. I already have a script in place, but it requires an additional c ...

Tips for inputting information without redundancy after selecting a specific designation

I'm experiencing a challenge with this code as it repeats when already chosen. My goal is to add data in the database once something has been selected. When I click on spin, the randomizer will choose a name and update their status to "done". Subsequ ...

Avoid refreshing the page when clicking on an anchor tag in Vue.js

I have the code below in my Vue file. The problem I am encountering is that the page reloads whenever I click on the link. I have tried using event.preventDefault() but it did not solve the issue. Can someone please help me identify what I am doing wrong ...

Footer overlapping occurs on a single page

My webpage is having an issue where the footer is overlapping. It seems to be fine on all other pages except for this one. I would prefer not to make any changes to the footer since it's working correctly on other pages. Is there a way to adjust the C ...

Having trouble saving text in a textbox?

Is there a way to store text in a text box for future use? Every time I reload the page, the text in the box disappears. I have attempted the following solution: <td align='left' bgcolor='#cfcfcf'><input type="text" name="tx ...

AngularJS is failing to recognize the onload event when loading a URL

I am currently working with the AngularJS Framework and I have encountered an issue. My directive only seems to work when the window is fully loaded. screensCreators.directive('createscreen', function () { return { restrict: "A", ...

Having trouble getting CSS calc to work on a table cell? Wondering how to make two out of four columns the same width?

Is it possible that CSS calc doesn't work on a table cell? It seems that no matter what size I change 90px to, the result looks the same. Even after trying various calculations with calc, I cannot seem to achieve the desired number of 230. The goal i ...

Guide on showcasing the values from two text fields with autocomplete suggestions in a third text field

Hey there, I have a search form that takes values from two text fields and combines them to populate a third text field for querying. <form name="form1" method="post" action="" autocomplete="off" oninput="sea.value = password.value +''+ passw ...

The input field automatically populates with the username that has been stored in the browser's form

Issue: I have created an input field with the type text, but upon page load, it gets automatically filled with a username saved in the browser's form data for this website's login page. I want it to show up clean when the page loads. <input t ...

Unexpected CSS counter reset issue encountered within nested elements

Utilizing css counters for the formatting of certain wiki pages is a common practice that I implement by adding CSS directly to the wiki page. One particular use case involves numbering headers using counters. Below is a snippet of the code that demonstra ...

Problem with items overlapping in hoverable drop-down menu

I have been attempting to create a hoverable dropdown menu, but I am encountering an issue where the items of the dropdown are overlapping. Despite my efforts to adjust the CSS classes, I have not been successful in fixing this problem. Additionally, I ha ...

Is there a way to automatically activate the "Add" button when I hit the enter key in the text box?

Being someone who relies on to-do lists, I implemented a system where you can input tasks into a textbox and click the add button to see them listed below. However, I found it cumbersome to keep clicking the add button every time I wanted to quickly add mu ...

Select2.js Dropdown List with Case Sensitivity

Currently making use of select2.js version 4.0.3 Situation: Imagine the dropdown list contains the following options: JavaScript javascript Javascript javaScript So, when a user types in java, all options are displayed (case is n ...

Item floating in a list

I'm facing a challenging issue that I need help with. It's a bit complicated to explain, but I'll do my best. There's also a picture included to help illustrate the problem. The problem I have is with an ordered list. When the next row ...

The JavaScript file failed to load

My HTML code is having trouble loading all the files. The Javascript files UserController.js and RepoController.js are not being loaded, which means they are not displayed in the developer tools source tab. When I press F5 in the network tab, the files are ...

Tips for customizing the appearance of material-ui SelectField

Currently, I am utilizing material-ui alongside react with the version "material-ui": "^0.19.2". I am facing an issue while attempting to embed a SelectField inside a table. Although the functionality is working smoothly, there are two unexpected behaviors ...

Tips for utilizing document.write() with a document rather than just plain text

Currently, I am utilizing socket.io to develop a party game that shares similarities with cards against humanity. My main concern is how to retain the players' names and scores without needing to transmit all the data to a new page whenever new games ...

Troubleshooting a Border Problem in CSS

Just joined this site and I'm new to coding, eager to learn more. I'm trying to make the border of this grey box grey, with the rest being blue. I've searched online but can't find exactly what I need. The grey area is 200px wide and ...

Elements not following percentage in top positioning

I am facing an issue with resizing containers on my webpage. Despite using position: relative for everything, I am unable to properly adjust the size of the top containers using percentages. Any assistance would be greatly appreciated! ...