I am trying to make an home page for my website and its not sticking to one page and expands to around 120% height, when I set it to 100% height. I am trying to set my h1 and p tags in the middle of the page. When i use inspect and try to shrink the width as if I was on a mobile device the footer doesn't stay at bottom:0; as written in the css but instead it moves up as if footer position was set to bottom: 20%.
html, body{
margin: 0;
padding: 0;
width: 100%;
font-family: sans-serif;
height: 100%;
}
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
.container {
padding: 10% 5%;
justify-content: center;
align-content: center;
text-align: center;
height: 70%;
margin-left: auto;
margin-right: auto;
}
.headerNav {
background-color: rgb(0, 0, 0);
color: white;
font-weight: bold;
text-transform: uppercase;
z-index: 100;
max-width: 100%;
right: 0;
top: 0;
left: 0;
padding: 10px 0px;
font-size: 20px;
display: grid;
grid-template-columns: auto auto;
}
.homePG{
text-decoration: none;
text-align: left;
padding: 10px 10px;
}
.headerLogin{
text-align: right;
grid-gap: 5px;
}
footer {
position: relative;
text-align: center;
background-color: black;
color: white;
padding:10px;
font-size:15px;
bottom: 0;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<title>Brandon's Login System</title>
<link rel="stylesheet" href="includes/header.css">
<link rel="stylesheet" href="includes/footer.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<nav class="headerNav">
<nav>
<a href="./index.php" class="homePG">HOME</a>
</nav>
<div class="headerLogin">
<form class="headerForm" action="includes/login.inc.php" method="POST">
<input type="text" name="mailuid" placeholder="Username/E-mail...">
<input type="password" name="pwd" placeholder="Password...">
<button type="submit" name="login-submit">Login</button>
<a href="signup.php">Sign Up</a>
</form>
</div>
</nav>
<section class="container">
<h1>HOME PAGE</h1>
<p>
Welcome to the home page.
</p>
</section>
<footer>
© 2020 Brandon Ng
</footer>
</body>
</html>