What is the best way to create a Bootstrap div that spans the entire page?

I am trying to create a full-page background with two columns: one in gray (col-9) and the other in blue (col-3). Below is the code for these two columns:

@media print {
  @page {
    size: auto;
    margin: 0;
  }
}
<html>

<head>
  <title>Test Full Page</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
  <script src='https://kit.fontawesome.com/a076d05399.js'></script>
</head>

<body>
  <div class="container">
    <div class="row">
      <div class="col-9 h-100" style="background-color:#F8F8FF;">
        <div style="margin-top: 20px;">
          <div class="row">
            <div class="col-11">
              <br />
              <h4>Title</h4>
              <hr>
            </div>
          </div>
          <div class="row" style="padding-left: 1.5rem;">
            <div class="col-6">
              <strong>Title</strong>
              <p align="justify">
                <span>Date</span>
              </p>
              <p align="justify">
                Blablabla
              </p>
            </div>
          </div>
        </div>
      </div>
      <div class="col-3 h-100" style="background-color:#0BA9FE;">
      </div>
    </div>
  </div>
</body>

</html>

Could anyone guide me on how to ensure that both div columns have full height on all pages? Currently, they do not fill the entire page even after adding the h-100 class.

Your help would be greatly appreciated.

Thank you

Answer №1

Eliminate h-100 from the div's class attribute. For the correct code, visit: https://jsfiddle.net/pallaviyadav/n3Lus0v7/8/

<html>

<head>
  <title>Test Full Page</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
  <script src='https://kit.fontawesome.com/a076d05399.js'></script>
</head>

<body>
  <div class="container">
    <div class="row">
      <div class="col-9" style="background-color:#F8F8FF;">
        <div style="margin-top: 20px;">
          <div class="row">
            <div class="col-11">
              <br />
              <h4>Title</h4>
              <hr>
            </div>
          </div>
          <div class="row" style="padding-left: 1.5rem;">
            <div class="col-6">
              <strong>Title</strong>
              <p align="justify">
                <span>Date</span>
              </p>
              <p align="justify">
                Blablabla
              </p>
            </div>
          </div>
        </div>
      </div>
      <div class="col-3" style="background-color:red;">
      </div>
    </div>
  </div>
</body>

</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to ensure an image or ad stays in a fixed position on the screen

Is there a way to keep a part of the screen fixed, regardless of what other elements are in that space? Do I need to merge code with the HTML code of the ad or image to achieve this? ...

Why is Google flagging my website as not mobile-friendly?

I have developed a website using Next.js with responsive design implemented through Bootstrap and a touch of SCSS. The site displays perfectly on my Samsung S8 phone and other devices, but Google warns me that the text is too small, buttons are not prope ...

Exploring the varying flexbox behavior with (overflow-y) scroll on Safari, Firefox, and Edge compared to Chrome

When viewing this plunker page on Chrome for Windows and Android (including Canary), everything functions properly. I am able to scroll the two areas on the left and right, and the top and bottom divs of the page remain at the top and bottom of the device ...

How to restrict CSS div from expanding with content and implement scrollbars instead?

Can anyone assist me with this issue? I am struggling to make the div (the gray area behind the video) expand with the content, instead I keep getting scrollbars. Any suggestions would be greatly appreciated. Thank you, Marcus If you try scrolling over t ...

What is the best way to position a rectangle on top of a div that has been rendered using

I recently started using a waveform display/play library known as wavesurfer. Within the code snippet below, I have integrated two wavesurfer objects that are displayed and positioned inside div elements of type "container". My goal is to position my own ...

Struggling with CSS layout: Organizing and nesting divs

I am striving to create a layout like the one shown here: https://i.sstatic.net/LInER.jpg Presented below is my current HTML structure: <div id="main"> <div id="content1"> <span>Content1</span> <div id="text ...

Create a login <div> that appears to float effortlessly on the screen

Seeking assistance in creating a login div similar to the one on ups.com. Upon clicking the login button on www.ups.com, a floating login div appears. How can I generate a similar div? Any help would be greatly appreciated. Thank you. ...

Conditionals in ng-class Syntax

I'm attempting to apply a class conditionally to an element, but I'm struggling with the correct syntax. I've experimented with the code below, but it's not functioning as expected: ng-class="{foo: bar === "true"}" The value of bar i ...

Activate a dropdown menu following the selection of a date on a calendar input using vue.js

What I need to do is have two select fields, one for 'days' and the other for 'hours'. When a day is selected, the user should then be able to choose between two available time slots. If they choose day two, the available time slots sh ...

Is it necessary to scroll when all elements on the page are in absolute position?

I have all elements positioned absolutely on my page. Some are at the top and some are at the bottom. However, when I add an additional element to display news text in the center of the page, it gets hidden under the element aligned at the bottom. When I s ...

When the div element reaches the top of the page, it sticks to the top and is only displayed when the user

In the center of a full-screen hero section, there is a form. When it reaches the top, its position becomes fixed and additional classes are added through a script - such as shrinking its height and adding a background. What I aim to achieve is for the fo ...

What is the best way to eliminate the blue-box-fill when buttons are clicked?

Check out this screen recorded gif on my device showcasing the blue-box-fill I'm referring to: https://i.stack.imgur.com/ajr2y.gif I attempted the following solution: * { user-select: none; -webkit-user-select: none; /* Safari */ -khtml-user-s ...

What causes duplicate hyperlinks when adding padding to an anchor tag?

nav ul li a { display : block ; text-align : center; font-weight : 600; text-decoration : none; color:#fff; background-color : rgba(0,0,0,0.15); margin : .2em 0; padding: .2em 0; b ...

Repeated Hover Effects on CSS Menu Icons

the webpage I need help with is (issue with general menu drop down) Hello I recently decided to enhance my menu by incorporating icons. I had successfully implemented a drop-down menu using only HTML and CSS, but when I attempted to add icons next to ea ...

Is there a way for me to retrieve the widths of all child elements within an HTML document?

I have been working on a JavaScript (jQuery) function to calculate the maximum width of all child and children's-child elements within a specific div element. Here is the code I have written so far: function setBodyMinWidth(name){ var max = 0; $(nam ...

A regular expression for duplicating a line with modifications and mirroring it

I am looking to replicate a code snippet on each HTML page, with some modifications: For example: <title>Any text (even if includes :.,</title> Desired output: <title>Any text (even if includes :.,</title> <meta name="descrip ...

Is there a way to ensure that neighboring divs have the same height as the tallest div in a row?

In the product description column, the value spans two lines, causing the row to adjust its height accordingly. However, the issue arises when adjacent divs do not match this height, resulting in an incomplete border as shown in the image below. This probl ...

Dynamic content alongside a stationary sidebar that adjusts in width

Attempting to create a switchable sidebar (toggling between short and long form) using bootstrap, multiple examples, and online resources. The width of the sidebar changes when toggled, and I want the content to appear next to it regardless of its length. ...

The ability to use the backspace and Ctrl + c (Copy) functions is restricted in input fields on FireFox

I have a form with input fields designed using semantic UI. I need the input field to only accept numbers, remove spaces, and allow copying from it using ctrl +c. After some investigation, I found this jQuery code that seems to satisfy my requirements per ...

Is it possible to have the navigation bar (bootstrap) appear on top of my slider as the default setting, without taking up additional space?

I'm encountering a rather simple issue that's giving me some trouble. I'm currently working on a website design using Bootstrap, and initially, there were no image sliders included by default. After integrating an image slider, I noticed th ...