I've been working on creating a responsive menu using HTML and CSS, and everything is functioning well so far. However, I'm facing an issue with the mobile view of the menu. When the menu opens up, it obstructs the text below it, making it difficult for users to see the menu items.
html, body{
width:100%;
height:100%;
margin:0;
}
html {
font-family:"helvetica neue", sans-serif;
}
.nav{
border-bottom: 1px solid #eaeaeb;
text-align:right;
height:50px;
line-height:50px;
}
.menu{
margin:0 30px 0 0;
}
.menu a{
clear:right;
text-decoration:none;
color:gray;
margin: 0 10px;
line-height: 50px;
}
span{
color:#54D17A;
}
label{
margin:0 40px 0 0;
font-size:26px;
line-height: 50px;
display: none;
width:26px;
float:right;
}
#toggle{
display:none;
}
/*Media*/
@media only screen and (max-width:500px){
label{
display:block;
cursor: pointer;
}
.menu{
text-align: center;
width:100%;
display:none;
}
.menu a{
display: block;
border-bottom: 1px solid #eaeaeb;
margin:0;
line-height: 50px;
}
#toggle:checked + .menu{
display:block;
}
#menu a:clicked + .menu {
display:none;
}
}
<div class="nav">
<label for="toggle">☰</label>
<input type="checkbox" id="toggle"/>
<div class="menu">
<a href = "#">Business</a>
<a href = "Services.html">Services</a>
<a href = "#">Learn more</a>
<a href = "#"><span>Free Trial</span></a>
</div>
</div>
<div class="stuff">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Delectus similique voluptatum quas sit accusantium molestiae, cupiditate magnam soluta, ab inventore possimus placeat ipsum eum perspiciatis ipsam nobis nulla tenetur assumenda.
</div>
In the mobile view, when the menu is opened, it overlaps with the content below. Is there a way to push the content down so that the menu remains visible? Alternatively, are there any other solutions to ensure that both the menu and toggle icon are clearly visible to users?