I know my question is hard to understand but I have made a gif to explain my problem. I would like the menu to go above the horizontal bar without activating it.
CSS of the vertical menu :
.dropbtn {
color: white;
padding: 5px 10px;
border: none;
cursor: pointer;
}
.dropbtn a {
font-weight: bold;
text-decoration: none;
color: #ffffff;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
right: 0;
text-align: left;
background-color: #f9f9f9;
min-width: 200px;
z-index: 3;
padding: 5px;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
z-index: 4;
}
.dropdown-content a:hover {
background-color: #dddddd;
}
.dropdown:hover .dropdown-content {
display: block;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown:hover .dropbtn {
background-color: #ffffff;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown:hover .dropbtn a {
color: #333333;
}
CSS of the horizontal bar :
nav {
margin: 27px auto 0;
position: relative;
width: 800px;
height: 50px;
background-color: #34495e;
border-radius: 8px;
font-size: 0;
}
nav a {
line-height: 50px;
height: 100%;
font-size: 15px;
display: inline-block;
position: relative;
z-index: 1;
text-decoration: none;
text-transform: uppercase;
text-align: center;
color: white;
cursor: pointer;
}
nav .animation {
position: absolute;
height: 100%;
top: 0;
z-index: 0;
transition: all .5s ease 0s;
border-radius: 8px;
}
a:nth-child(1) {
width: 400px;
z-index: 2;
}
a:nth-child(2) {
width: 400px;
z-index: 2;
}
nav .start-home,
a:nth-child(1):hover~.animation {
width: 400px;
left: 0;
background-color: #39aeb4;
}
nav .start-likes,
a:nth-child(2):hover~.animation {
width: 400px;
left: 400px;
background-color: #39aeb4;
}
As you can see, I tried to add some Z-Index properties to the menu but that didn't change anything.
Thanks for your help !
Aucun commentaire:
Enregistrer un commentaire