I made a burger-menu with a pseudo-element. Now I need to show a menu, if a pseudo-element is hover.
I can choose it this way :.header:hover:before
But I can't force the menu to depends on it.
It's a structure of html:
<header class="header">
<a href="#"><img src="img/logo.svg" alt="logo" class="logo logo_header"></a>
<nav class="menu menu_header">It's a menu</nav>
<div class="contacts-header">Some contacts here</div>
</header>
It's CSS:
.header:before {
content: '';
display: block;
width: 40px;
height: 30px;
background-image: url("../img/icon-burger-menu.svg");
background-repeat: no-repeat;
background-position: center;
background-size: contain;
}
.menu {
display: none;
}
.header:hover:before **???** {
display: block;
}
Is it possible to use a selector in this case?
<button>
containing an<img>
withalt
text and JavaScript to trigger then. Then it will work for people who can't use a mouse or who depend on screen readers. CSS hacks for "easy" interactions are just causes of accessibility problems.