There is a gap appearing at the bottom of the page on mobile browsers when the height is set to 100vh or

I am facing an issue with my webpage where I want certain divs (with the class "full") to be as tall as the viewport height of the user. This setup works perfectly on desktop browsers like Ubuntu in Firefox, but I encounter a problem on mobile devices such as Android in Chrome. There is a small white gap visible at the bottom of the screen when viewed on my smartphone.

div.full {
    min-height: 100vh !important;
}

html,body {
    min-height: 100vh !important;
    height:100vh;
    margin:0px;
    padding:0px;
}

body {
    position: relative; 
    background: url(../img/background.jpg) no-repeat center center fixed;  
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

As I scroll down the page, this gap seems to increase. It appears to be a combination of the height of the android status bar and the address bar of Chrome. When not scrolling, it only reflects the height of the status bar.

Switching to using 100% instead of 100vh did not resolve the issue for me.

Removing the line height:100vh; from the html, body block does eliminate the gap, but introduces a new problem: The background image becomes heavily blurred due to excessive scaling...

Is there a way to ensure that a div remains exactly 100% high across all devices, even when users are scrolling?

Answer №1

After some troubleshooting, I believe I have finally figured it out. While the code provided in the question was accurate, I found that there was additional code in my CSS causing an issue:

.ref-logo {
    width: 400px;       
}

This extra code appeared to be causing a scaling problem on my page. I realized this when I noticed that the navbar button only appeared when I scrolled to the right...

The solution I found is as follows:

.ref-logo {
    max-width: 400px;
    width: 90%;
}

It's moments like this that remind me why I am not cut out for web development! :P

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

Using jQuery and cheerio to iterate through a collection of items

I am currently reviewing the elements within 2 HTML tables: <table class="content"> <tbody> <tr> <th>title1</th> <td>info1</td> </tr> <tr> ...

A customizable checkbox component in React that includes an image and doesn't require an

I am working on creating a versatile React component for checkboxes. After familiarizing myself with the traditional image-replacement technique for checkboxes, I have implemented it in my React code: import React, { Component } from 'react'; ...

Addressing the issue of compatibility with iPhone 5 and 5S in both portrait and landscape modes

I made an attempt to conceal certain elements specifically on iPhone 5 & 5S in both portrait and landscape orientations, but unfortunately, it ended up affecting all iPhone devices. Below is the code snippet used: @media only screen and (min-device ...

Tips for aligning images and text in the center of a row using Bootstrap

I am struggling to center the image along with the text in my code. I attempted to use a container, but it did not have the desired effect. Below is the image: https://i.sstatic.net/fnaj4.png <section id="features"> <!-- <div ...

Avoiding HTML in JavaScript: Tips and Tricks

My application generates numerous elements dynamically based on server data in JSON format. This process involves embedding a significant amount of HTML directly within my JavaScript code, leading to pollution and making it increasingly challenging and l ...

Display hyperlinks upon hovering over text

In the sign-up form, there are options for two different types of users: teachers and students. When the sign-up option is selected, a drop-down menu with choices for teacher and student will appear. However, I would like it to function more like other w ...

Combining Applet with Microsoft Access

This is a more specific version of my original inquiry. I have successfully created an applet that should interact with my MS Access database. It runs smoothly through a compiler, but when I embed the .class file in an html page and open it, the applet run ...

My goal is to create a platform where users can upload a basic 3D model and customize it by engraving a rectangular shape onto it using their own specifications

Starting my journey in web development, it seems like I'll be delving into Three.js. However, I'm a bit unsure of where to begin and how to navigate this new territory. The idea is to have an STL file displayed on my webpage with three text fiel ...

The execution of my JavaScript code does not pause for the completion of an ajax request

I'm currently working on a register validation code in JavaScript. One of the key aspects checked by the validation function is whether the email address provided by the user already exists in the database. To handle this, I'm implementing ajax, ...

Having difficulty retrieving the Area and Range information in ChartJS

I am new to working with HTML5 and ChartJS. I have noticed two different types of declarations when attaching JS Chart Versions 1.0.1 and 2.1.1. Can you please provide some insight into this? Additionally, I am facing an issue where the stripes behind the ...

Experience the sensation of gliding on a particular object within the application interface, all without relying on pixel

I am currently working on an app that features a sliding bar element, and I am looking for a way to simulate the sliding motion. Is there a method that allows me to select an element and slide it by a percentage of the screen rather than a set number of pi ...

Issue with Firefox causing Bootstrap form to appear incorrectly

I recently created a customized form using Bootstrap, but unfortunately, I'm encountering an issue with Firefox. Despite functioning perfectly on other browsers, the radio buttons are being pushed off the edge of the page and aren't displaying pr ...

A quicker and more efficient way to locate views in Android: Alternate methods for

What are some alternatives to using findViewById in my app? My layout is complex and using findViewById to traverse its tree to find views takes up too much time, especially since it is used multiple times. ...

When is the appropriate time to nest CSS class selectors within other class selector definitions?

REVISED 1 After receiving feedback, I made the following changes: .lower-container { justify-content: center; position: absolute; width: 92vw; // height: 46vh; <--- no set height /* nested classes for adjusting position and height of low ...

Obtaining the text of a span tag within a div using Selenium in C#

<div id="uniqueSummaryID" class="custom-text" data-reactid=".0.0.0.3.0.0.1.0.0.0.0.$unique_key_25.1.1.0"> <span data-reactid=".0.0.0.3.0.0.1.0.0.0.0.$unique_key_25.1.1.0.0">5</span> <span data-reactid=".0.0.0.3.0.0.1.0.0.0.0.$unique_ke ...

Apply a blurred effect to the entire website except for one specific element

Recently, I implemented the .blur class on the body element to create a blurred effect for the entire website. CSS .blur { filter: blur(1px); filter: url("blur.svg#gaussian_blur"); -webkit-filter: blur(1px); -o-filter: blur(2px); } HTML ...

Modification of file types (HTML input[type=file])

Is it feasible to generate a new file of a specific type from the currently uploaded file in the input? After uploading a file, I attempted to modify its type directly within an onChange event but received an error stating that it is a read-only property ...

The mixin 'media-breakpoint-only' is not defined

Recently, I decided to delve into coding with Bootstrap4 and Sass. I made sure all the necessary configurations were in place for my environment/project setup: including ruby 2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32] and a list of installe ...

ui-router: Issue with ui-sref causing font color to remain unchanged

I've been trying to customize the font color of a navigation link using ui-router's ui-sref functionality, but I'm facing an issue. While I can change the background color by adding it to the .active class in my CSS, the font color remains u ...

Inquiries about the inner workings of a try-catch block before an error occurs

My try-catch block looks like this: try { try { GeoPoint dummy = new GeoPoint(0, 0); deviceCompatibleWithMaps=true; } catch (Throwable t) { t.printStackTrace(); d ...