I do not master the art of scripts and am creating a responsive menu page. I've done a lot of research and I'm testing a form that has not worked so far.
I created the following code html
:
<div class="header" id="menu-header">
<nav class="menu-header">
<ul>
<li><a href="#funcionalidades">Funcionalidades</a></li>
<li><a href="#">FAQ</a></li>
<li><a href="#precos">Preço</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contato</a></li>
</ul>
<a class="toggle-nav" href="#menu-header-resp">☰</a>
</nav>
</div>
<div id="menu-header-resp">
<nav>
<ul>
<li>teste</li>
<li>teste 2</li>
</ul>
</nav>
</div>
With this html
, I also created the following css
commands:
.toggle-nav {
display:none;
}
div#menu-header-resp {
display: none;
}
div#menu-header-resp:target {
display: block;
}
@media screen and (max-width:1000px) {
nav.menu-header ul {
display: none;
}
.toggle-nav {
display: block;
color: rgba(255,255,255,.55);
font-weight: 700;
font-size: 21px;
}
.toggle-nav:hover {
color: rgba(255,255,255,.75);
transition: .2s;
}
}
I came to this stage of code after studying a lot about the target
function.
In summary, my intention is that div id="menu-header-resp"
is not displayed unless it is called by a class="toggle-nav"
.
I had the idea of creating these codes after reading one of the answers to this question: Clicking on an image will pop up a div