There are 4 section divs that need to be displayed in the center of the page when clicked, but the last one appears further down. This is likely due to the flex box nature. What is the best way to ensure all sections appear at the exact same location?
Another JavaScript question - Is there a more efficient way to write this script? It seems cumbersome for its purpose and I'm looking for suggestions on how to simplify it.
function about() {
var about = document.getElementById("about");
var contact = document.getElementById("contact");
var work = document.getElementById("work");
var blog = document.getElementById("blog");
if (about.style.visibility === "hidden") {
about.style.visibility = "visible";
contact.style.visibility = "hidden";
work.style.visibility = "hidden";
blog.style.visibility = "hidden";
} else {
about.style.visibility = "hidden";
}
}
/* Remaining JavaScript functions go here */
* {
margin: 0;
padding: 0;
}
html {
font-size: 100%;
}
body {
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
/* CSS styling continues here */
<main>
<section id="about" style="visibility: hidden;">
<p>Developer, providing modern and responsive web development.</p>
</section>
<section id="contact" style="visibility: hidden;">
<a href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="87eae6e4e3e2f1efc7e0eae6eeeba9e4e8ea">[email protected]</a>"><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0ada1a3a4a5b6a880a7ada1a9aceea3afad">[email protected]</a></a>
/* HTML content continues here */
</section>
</main>