I made this menu, but the problem is that by having a submenu and by doing :hover
in the li
container of the sub li
, the effect what did I do, apply to li contenedor
and%% of% where the mouse is passing , how do you fix that problem?
#menu a {
text-decoration: none;
font-family: monospace;
color: #fff;
font-size: 15px;
display: block;
font-weight: 600;
}
#menu ul {
list-style: none;
padding: 0;
background-color: black;
display: table;
width: 101%;
}
#menu {
list-style: none;
padding: 0;
background-color: black;
display: table;
width: 100%;
}
#menu > li {
float: left;
width: calc(100%/3);
}
#menu li:hover {
background-color: green;
transition: .8s;
}
#menu li {
line-height: 3em;
text-align: center;
position: relative;
}
#menu li ul {
position: absolute;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<nav>
<ul id="menu">
<li><a href="#">Inicio</a></li>
<li><a href="cp.html">Computación</a>
<ul>
<li><a href="js.html">Javascript</a>
<li><a href="fp.html">Fundamentos</a>
</ul>
</li>
<li><a href="cp.html">Acerca</a>
<ul>
</nav>
</body>
</html>