I am struggling with the alignment of a login page form that needs to be centered both horizontally and vertically, while allowing for slight scrolling down to accommodate the navigation bar height. I have attempted to adjust the classes and style heights, but it seems to affect the form's positioning in the center of the page. Any guidance on resolving this issue would be highly appreciated.
<nav class="navbar navbar-expand-lg navbar-dark bg-dark static-top">
<div class="container">
<a class="navbar-brand" href="login.php">Web App</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="splash.php">Choose Login</a>
</li>
</ul>
</div>
</div>
</nav>
<section id="cover" class="min-vh-100">
<div id="cover-caption">
<div class="container">
<div class="row text-white">
<div class="col-xl-5 col-lg-6 col-md-8 col-sm-10 mx-auto text-center form p-4">
<h1 class="display-4 py-2 text-truncate">Student Login.</h1>
<div class="px-2">
<form action="" method="POST" autocomplete="off" class="justify-content-center">
<div class="form-group">
<label class="sr-only" for="studentnumber">Student Number:</label>
<input type="number" min="1" class="form-control" name="studentnumber" placeholder="Student Number">
</div>
<div class="form-group">
<label class="sr-only" for="password">Password:</label>
<input type="password" class="form-control" name="password" placeholder="Password">
</div>
<button type="submit" name="submit" class="btn btn-primary btn-lg">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
<style>
#cover {
background-size: cover;
height: 100%;
text-align: center;
display: flex;
align-items: center;
position: relative;
}
#cover-caption {
width: 100%;
position: relative;
z-index: 1;
}
/* only used for background overlay not needed for centering */
form:before {
content: '';
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
background-color: rgba(0, 0, 0, 0.3);
z-index: -1;
border-radius: 10px;
}
</style>