I want to make a section from my main tag take up full screen but when I am doing this, my footer overlays the following sections after the first one. How can I resolve this without the method of setting the height of the section to 100vh, because i know this will provoke issues while scrolling on mobile.
Here is a sample code:
* {
margin: 0;
padding: 0;
}
html,
body,
main {
height: 100%;
}
header {
background: yellowgreen;
padding: 5% 0;
position: fixed;
z-index: 2;
width: 100%;
}
.section1 {
height: 100%;
background-color: rgb(83, 200, 247);
}
.section2 {
background-color: pink;
}
.section3 {
background-color: red;
}
footer {
background: rgb(53, 53, 53);
color: white;
height: 10%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./css/main.css">
</head>
<body>
<header>
This is header.
</header>
<main>
<section class="section1">
This is Section 1.
</section>
<section class="section2">
This is Section 2.
</section>
<section class="section3">
This is Section 3.
</section>
</main>
<footer>
This is footer.
</footer>
</body>
</html>