Mi menú de hamburguesas empuja hacia abajo la imagen de mi héroe cuando se hace clic, he intentado agregar el índice z o posiciones absolutas y relativas, pero arruina el menú de hamburguesas.
Soy un principiante y he estado devanándome el cerebro durante aproximadamente 2 horas con esto.
Esto comenzó a suceder cuando edité mi ancho máximo para que fuera 1200 px en lugar de 600 px
body { font-family: Montserrat; margin: 0px; } /* Style the links inside the navigation bar */ .topnav a { display: inline-block; text-align: center; text-decoration: none; font-size: 15px; color: black; width: 32.8%; padding-top: 10px; } /* Changes color of links on hover */ .topnav a:hover { color: #ffffff; } /* Add an active class to highlight the current page */ .topnav a.active { color: #ffffff; } /* Hide the link that should open and close the topnav on small screens */ .topnav .icon { display: none; float: right; } /* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */ @media screen and (max-width: 1200px) { .topnav a:not(:first-child) { display: none; } .topnav a.icon { float: right; display: block; color: white; } } /* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */ @media screen and (max-width: 1200px) { .topnav.responsive { position: relative } .topnav.responsive a.icon { position: absolute; padding-left: 82.5%; top: 0; } .topnav.responsive a { float: none; display: block; text-align: left; padding-top: 10px; padding-left: 7.5%; } } <!-- Nav Bar and background --> <div class="hero"> <div class="topnav" id="myTopnav"> <a href="#home" class="active">About Me</a> <a href="#portfolio">Portfolio</a> <a href="#about">Contact</a> <a href="javascript:void(0);" class="icon" onclick="myFunction()"> <i class="fa fa-bars"></i> </a> </div> <img src="IMG_8302.png" alt="Avatar"> <div class="hero-text"> <h1>Hey! I'm Zoe</h1> <p>I'm a Junior Web Developer</p> <p>Feel free to have a look around my website</p> </div> </div>