As I delve into the realm of Bootstrap, I am faced with a challenge in centering a form on my webpage. I have utilized CSS styling to ensure that both the html and body tags span 100% of the page's height. Additionally, I have created two divs: one outer div that occupies the entire page height and is styled with "justify-content-center," and an inner div styled with "align-items-center" to center the form. While this method successfully centers the form, I am left with unwanted whitespace above and below it.
My query may be somewhat ambiguous, but I seek advice on how to either eliminate this excessive whitespace (such as by adjusting the container size) or explore alternative methods for centering a div.
Currently, I am utilizing jade/pug as my view template engine. Below is the source code snippet:
block content
div(class="row h-100 justify-content-center")
div(class="d-flex align-items-center shadow-lg p-3 mb-5 bg-white rounded")
div
h3(class="text-center") Submit Your Attendance
form
div(class="form-group")
label(for="firstname") First Name
input(class="form-control", type="text", id="firstname", placeholder="John", name="firstname")
div(class="form-group")
label(for="lastname") Last Name
input(class="form-control", type="text", id="lastname", placeholder="Doe", name="lastname")
div(class="form-group")
label(for="email") Email Address
input(class="form-control", type="text", id="email", placeholder="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bcd6d3d4d2d8d3d9fcd9d1ddd5d092dfd3d1">[email protected]</a>", name="email")
div(class="text-center")
button(class="btn btn-primary", type="submit") Submit
Furthermore, here is the layout.jade file from which the code inherits:
doctype html
html(style="height:100%")
head
title= title
link(rel='stylesheet', href='/node_modules/bootstrap/dist/css/bootstrap.min.css')
script(src="/../node_modules/jquery/jquery.min.js")
script(src="/../node_modules/popper.js/dist/umd/popper.min.js")
script(src="/../node_modules/bootstrap/dist/js/bootstrap.min.js")
body(style="height:100%;background-image:url(../public/images/index-background.jpg);")
block content
To visualize the issue, refer to this screenshot of the page: screenshot of the page
I would greatly appreciate any insights or suggestions. Thank you for your assistance!