After struggling for some time, I can't seem to figure out how to center elements in the middle of a page without having a lengthy navigation bar at the bottom of the screen. Does anyone have any suggestions?
https://codepen.io/picklemyrickle/pen/XWjzyvb
#h2 {
position: absolute;
width: 100%;
left: 40%;
margin-top: 60px;
}
#form {
position: absolute;
top: 50px;
left: 10px;
}
#benefits {
position: absolute;
left: 40%;
margin-top: 160px;
}
<section id="h2">
<h2>Daniel's Get lean plan</h2>
<form id="form"
action="https://www.freecodecamp.com/email-submit">
<input type="email"
id="email"
placeholder="Enter your email here"
name="email">
<input type="submit"
id="submit">
</form>
</section>
I'm new here and excited to learn and improve my skills. If you have any advice or tips, please feel free to share. Thank you!
Looking forward to hearing from you!