When I adjust the size of my browser, the white space in the HTML

Using bootstrap to design a basic webpage, here is the picture of the page in full desktop width

https://i.sstatic.net/acTR5.jpg

I like how it fills up the entire page.

However, upon resizing Chrome to a smaller width, there seems to be white space at the bottom that I can't explain.

https://i.sstatic.net/z8uNW.jpg

To make matters worse, when I check developer tools, I notice that my html only covers my div, so why the extra space?

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}
/* SECTIONS */

section {
  padding-top: 2%;
  padding-bottom: 2%;
}
.main {
  position: relative;
  background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
  /* bottom, image */
  url(img/background.jpg);
  background-size: cover;
  padding-bottom: 56.25%;
  background-attachment: fixed;
}
.no-padding {
  padding: 0;
}
/* HEADINGS */

.welcome-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  color: white;
}
.welcome-area h1 {
  font-size: 500%;
}
<section class="main">
  <div class="welcome-area">
    <h1>Hello.</h1>
    <div class="row text-center btn-main">
      <button type="button" class="btn btn-primary btn-explore">EXPLORE</button>

    </div>
    <div class="row">
      <img src="css/img/face.jpg" alt="face" class="img-responsive img-face">
    </div>



  </div>
</section>

Answer №1

To optimize your layout, include height: 100% in your CSS for both html and body. Additionally, make sure to add

height: 100%; box-sizing: border-box;
specifically for the section element.

Furthermore, it is recommended to eliminate the padding-bottom property from the .main element for a more refined appearance.

Answer №2

Consider including the following code snippet in your CSS file:

html, body{
    width:100%;
    height:100%
}

This adjustment will expand the page to occupy the entire width and height of the screen.

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

Allow the width of the container to be determined by the img element

To achieve the desired effect of making the image resolution width dictate the container width without stretching it, I am facing a challenge. Currently, when the text within a paragraph element exceeds the width of the image, the entire container expands. ...

PHP code does not involve inputting data into a database table

I've hit a roadblock while trying to input form data into a database table. Despite following various tutorials, I haven't been successful so far. Can someone please assist me with this? (Right now, my main goal is to simply insert the data into ...

Ways to adjust the size or customize the appearance of a particular text in an option

I needed to adjust the font size of specific text within an option tag in my code snippet below. <select> <?php foreach($dataholder as $key=>$value): ?> <option value='<?php echo $value; ?>' ><?php echo ...

Organize a list using custom span values with JavaScript

<ul id="CoreWebsiteTopHeader_6_list"><li><a class="navigation" href="/seller"><span class="editableLinks" data-id="32638" data-sort="110">Seller</span></a></li><li><a class="navigation" href="/about">&l ...

Preventing div resizing in AngularJS through scroll functionality

I want to create dialog boxes that are draggable and resizable and can contain arbitrary HTML-formatted content. To achieve this, I am utilizing JQLite within a directive. The resizing functionality is triggered by a mousedown event on a div in the bottom ...

Transforming "datetime-local" into java.sql.Timestamp

I am working on a JSP page that has a form containing an input field with type "datetime-local". The data from this form is then passed to a servlet using the following code: String resetTimeString = request.getParameter(RequestParameterName.RESET_TIME); ...

How to properly format the <address> element on my website to display our company's contact information

While developing a website with asp.net mvc-5, it's important to include our company's contact details like telephone, email, and postal address. That's why I utilized the <address> tag within our "Contact US" page, replacing actual in ...

Adjust the vertical size and smoothly lower a text input field

When a user clicks on a textarea, I want it to smoothly change height to 60px and slide down in one fluid animation. Check out the JSFiddle example here: http://jsfiddle.net/MgcDU/6399/ HTML: <div class="container"> <div class="well"> ...

The play button on the video control appears blurry in iOS 9.3.2

My iPhone running iOS 9.3.2 is experiencing a display issue when I try to open an HTML page with a video tag. There seems to be a blurry initial play button as shown in the image. Any suggestions on how to fix this? https://i.sstatic.net/RmLMI.png .vid ...

Make sure the div is always positioned above everything, including any built-in pop-up windows

When working with two forms, one for user input and the other as a pop-up window to display results, users sometimes close the pop-up window prematurely if they think there is a network issue causing a delay in data execution. To prevent this, I am consi ...

Incorporating a recurring image beneath a navigation menu

I'm attempting to recreate a header that has a similar appearance to the following: https://i.stack.imgur.com/uVXs3.png However, I am facing challenges in generating the repeating diamond design beneath the black bar. The diamond pattern resembles t ...

Assigning a unique identifier to a button that will vary depending on the selected radio input

UPDATED HTML: The circumstances have changed because I am no longer in my office, but the concept remains unchanged. The situation is that on a certain part of a website, users have the option to choose from multiple saved addresses. Each address has a un ...

Utilizing AngularJS to display numerous charts on a single webpage

Currently, I am looking for a solution to display multiple charts on the same page. My goal is to showcase individual performance through each chart for different persons. After exploring Google Charts, I noticed that it requires unique "id" attributes w ...

Trigger Screen Reader to Announce When a Component Is Deleted

When the last filter item is removed, I want the screen reader to announce "All Filters Are Removed." However, if the active filter component is removed without any other element to assign an aria-label attribute, I'm not sure how to handle this situa ...

Get the number of elements that match your XPath expression

Currently engaged in an XML and XSLT project with a challenging task; the query requires me to count the number of open ports with a specific port number using the following path: liste_hotes --) hote --) liste_ports --) port num_p ...

Steps for adding a ::after border to a div

Looking for a way to create a border line separator between the top and bottom sections? I've been struggling with this task, but I have managed to make progress by adding a white line. However, I'm facing an issue where the container's widt ...

Retrieve the current domain name (server name) within a Shiny application

I am managing 3 servers - alpha, beta, and gamma. The goal is to deploy my Shiny code from the alpha server to the gamma server. However, I encounter a challenge. In my ui.R file, I reference another site called start using href = 'https://alpha.com/ ...

The display/block feature will only function if the div element is contained within a table

I am facing an issue with hiding/showing two div elements alternatively. The code works perfectly when the divs are placed within a table, but fails when they are not in a table due to compatibility issues with Internet Explorer. I prefer not to use a tabl ...

PDF files encoded in base64 are not displaying properly in Chrome

There seems to be an issue with certain PDF files not rendering properly in Chrome browser but working fine in Firefox. Interestingly, all files render correctly when embedded directly. <object id="content-view" :data="content_view.base64" type="applic ...

Trouble achieving center alignment of navigation bar using @media query in Firefox and IE

Looking for help with creating a video hub that includes a navigation bar? Instead of using an accordion nav collapse, I prefer the menu to carry onto the next line and be centered. Here is the code snippet I used to achieve this effect: @media screen and ...