Hello so i have a issue with my dropmenu when i hover it nothing happen can please someone tell what wrong i try to change visibility hidden by display none/block when i hover but nothing change.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="/css/maroc.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;0,700;0,900;1,300;1,400;1,700;1,900&display=swap"
rel="stylesheet"
/>
</head>
<body>
<header>
<nav>
<h1 >Morroco.</h1>
<ul >
<li >Découvrir le Maroc</li>
<ul >
<li>Histoire & Géographie</li>
<li>Art & Culture</li>
<li>Téchnologie</li>
</ul>
<li>Destinations</li>
<li>Infos Pratique</li>
<li>Nous Contacter</li>
</ul>
<i><img src="/img/menu_FILL0_wght400_GRAD0_opsz48.svg" alt="" /></i>
</nav>
</header>
<main></main>
<footer></footer>
</body>
</html>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Merriweather", serif;
}
nav {
width: 100%;
height: 80px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
}
.logo {
font-size: 30px;
}
.navitems {
display: flex;
list-style: none;
gap: 50px;
font-size: 20px;
text-transform: uppercase;
}
.drophover {
position: relative;
}
.dropmenu {
position: absolute;
top: 80px;
list-style: none;
line-height: 60px;
text-align: left;
box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset;
padding: 10px;
opacity: 0;
transition: opacity 200ms ease-in-out;
}
.drophover:hover.dropmenu {
opacity: 1;
}
I try to change opacity and visibility by display none and display block when i hover but nothing change
CodePudding user response:
You need to select your dropmenu
using the sibling selector:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Merriweather", serif;
}
nav {
width: 100%;
height: 80px;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
}
.logo {
font-size: 30px;
}
.navitems {
display: flex;
list-style: none;
gap: 50px;
font-size: 20px;
text-transform: uppercase;
}
.drophover {
position: relative;
}
.dropmenu {
position: absolute;
top: 80px;
list-style: none;
line-height: 60px;
text-align: left;
box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset;
padding: 10px;
opacity: 0;
transition: 200ms ease-in-out;
}
/*