Clicking menu on cs
-
Hello!
Tell me how to make a clip-floping menu, preferably css, with this particular feature: the menu is removed not only by pressing the reference but also by any space outside the menu. Example: such menus are often found in Yandex and Google.
-
Click menu
HTML код <a class="main-item" href="javascript:void(0);" tabindex="1" >Открыть подменю</a> <ul class="sub-menu"> <li><a href="#1">подпункт 1</a></li> <li><a href="#2">подпункт 2</a></li> <li><a href="#3">подпункт 3</a></li> </ul>
CSS код
.sub-menu
{
display: none;
}
.main-item:focus ~ .sub-menu,
.main-item:active ~ .sub-menu,
.sub-menu:hover
{
display: block;
}