I am currently utilizing Bootstrap 4 along with a custom CSS stylesheet for my website structure. Here is the layout:
<header>
<!-- content in header (fixed) -->
</header>
<main role="main" class="container-fluid">
<!-- main content -->
</main>
<div id="contact-information">
<!-- contact information section (absolute) -->
</div>
<footer class="footer">
<!-- content in footer (absolute) -->
</footer>
The issue I am encountering is that I want <main>
to occupy the entire space between <header>
and
<div id="contact-information">
. However, the actual layout shows a white gap in between:
<header>
<!-- header content -->
</header>
<main role="main" class="container-fluid">
<!-- main content -->
</main>
<!-- WHITE GAP -->
<div id="contact-information">
<!-- contact information section (absolute) -->
</div>
<footer class="footer">
<!-- footer content -->
</footer>
I have searched for solutions to this problem without success. I suspect that it might be related to my custom CSS. Below is the code for each section along with the respective HTML and CSS:
<main>
HTML & CSS
<main role="main" class="container-fluid" style="border: 2px solid red;">
<div id="content-container">
<div id="content-container-content">
<h2 class="text-uppercase">About Us</h2>
<hr>
<p id="content-container-sub-content">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.
</p>
</div>
</div>
</main>
main {
margin-top: 150px;
padding: 0 !important;
}
#content-container {
position: relative;
height: 432px;
background-color: white;
}
#content-container hr {
visibility: hidden;
}
#content-container-content {
position: absolute;
text-align: center;
width: 90%;
color: #83323e;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#content-container-sub-content {
font-size: 24px;
width: 100%;
color: #a63f4f;
line-height: 40px;
}
HTML & CSS<div id="contact-information">
<div id="contact-information">
<h3>Company Name</h3>
<p>12 Street, Area, City AB1 2CD, UK</p>
<p>Tel: (01234) 123-456 | Mobile: 01234567891</p>
<p>
<a href="#" class="text-white" target="_blank">View in Map</a>
</p>
<div>
<span style="cursor: pointer;">
<i class="fa fa-twitter fa-2x" aria-hidden="true" style="color: #00aced;"></i>
</span>
<span style="cursor: pointer;">
<i class="fa fa-youtube-play fa-2x" aria-hidden="true" style="color: white;"></i>
</span>
</div>
</div>
#contact-information {
position: absolute;
height: 283px;
width: 100%;
text-align: center;
color: white;
background-color: #a63f4f;
bottom: 60px;
padding: 50px;
}
Visual
https://i.sstatic.net/ZLIdO.png
As observed, the red border does not expand to fill the available space responsively.
Live Instance
You can view the live example here.
Thus, my inquiry is, how can I eliminate this white gap?