Upon closing my side navbar, I encountered an issue where the links warp to the size of the navbar. I am seeking a solution to keep the links (highlighted in pink in the image below) the same size without warping. Is there a CSS technique to achieve this? Thank you for any assistance!
Feel free to check out my codepen: https://codepen.io/toshvelaga/pen/OJymXxO
Below is the CSS styling for the navbar and its links:
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 2;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 1.5s;
padding-top: 60px;
}
.sidenav a {
padding: 8px 8px 8px 32px;
font-size: 25px;
color: #818181;
display: block;
text-decoration: none;
margin-left: 1rem;
}
Here is the JavaScript responsible for adjusting the navbar width:
function openNav() {
document.getElementById("mySidenav").style.width = "350px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
Check out the image below for reference: