Hi there! I am currently working on a CSS3 vertical menu for a mobile webpage. While the first level of the menu is functioning correctly, the same cannot be said for the second level. It seems to always show up on mouseover, despite my numerous attempts to fix it.
Although I am not an expert in CSS3 or HTML, I believe that I must be overlooking something crucial.
The HTML code snippet is as follows:
@media only screen and (max-width : 640px) {
/* ---------------------------------------------
Mobile Menu
--------------------------------------------- */
.m-menu {
margin: 0 auto;
padding: 0;
width: 100%;
}
.m-menu li { list-style: none; }
.m-menu li a {
display: table;
margin-top: 1px;
padding: 14px 10px;
width: 100%;
background: #78BE20;
text-decoration: none;
text-align: left;
vertical-align: middle;
color: #fff;
overflow: hidden;
-webkit-transition-property: background;
-webkit-transition-duration: 0.4s;
-webkit-transition-timing-function: ease-out;
transition-property: background;
transition-duration: 0.4s;
transition-timing-function: ease-out;
}
.m-menu > li:first-child a { margin-top: 0; }
.m-menu li a:hover {
background: #555555;
-webkit-transition-property: background;
-webkit-transition-duration: 0.2s;
-webkit-transition-timing-function: ease-out;
transition-property: background;
transition-duration: 0.2s;
transition-timing-function: ease-out;
}
.m-menu li ul {
margin: 0;
padding: 0;
}
.m-menu li li a {
display: block;
margin-top: 0;
padding: 0 10px;
height: 0;
background: #EEEEEE;
color: #515151;
-webkit-transition-property: all;
-webkit-transition-duration: 0.5s;
-webkit-transition-timing-function: ease-out;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: ease-out;
}
.m-menu > li:hover li a {
display: table;
margin-top: 1px;
padding: 10px;
width: 100%;
height: 1em;
-webkit-transition-property: all;
-webkit-transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-property: all;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
.m-menu > li:hover li a:hover {
background: #E7E7E7;
-webkit-transition-property: background;
-webkit-transition-duration: 0.2s;
-webkit-transition-timing-function: ease-out;
transition-property: background;
transition-duration: 0.2s;
transition-timing-function: ease-out;
}
/* Second level */
.m-menu > li > li:hover li a {
display: table;
margin-top: 1px;
padding: 10px;
width: 100%;
height: 1em;
-webkit-transition-property: all;
-webkit-transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
transition-property: all;
transition-duration: 0.3s;
transition-timing-function: ease-out;
}
}
<ul class="m-menu">
<li> <a href="#">MENU VOICE</a>
<ul>
<li><a href="#">FIRST LEVEL ITEM 1</a></li>
<li><a href="#">FIRST LEVEL ITEM 2</a></li>
<li>
<a href="#">FIRST LEVEL ITEM 3</a>
<ul>
<li><a href="#">SECOND LEVEL ITEM 1</a></li>
</ul>
</li>
</ul>
</li>
</ul>
Many thanks in advance for any assistance you can provide.
Sincerely, Chris