How do I calculate the height of a <header>
tag from a <main>
tag so that I can use the calc()
function to calculate the rest of the screen space available to span a banner in its place.
HTML:
<body>
<header>
<!-- A Navigation Bar of some sorts -->
</header>
<main>
<div class="banner">
<!-- Some text on the banner -->
</div>
</main>
</body>
And CSS:
.banner {
height: calc(100vh - /* Height of <header> */);
background-image: url(some image);
background-position: center;
background-size: cover;
}
Just an FYI... I'm designing for a project for college and for mobile specifically so this formatting will not span to desktop as I will change the styling for desktop and tablets