What could be the reason behind the additional gap at the bottom on mobile devices?

I've encountered an issue with my responsive website on the iPhone 11/11 pro where the background is visible at the bottom of the page. After researching, it seems like the CSS height property might be causing the problem. It was suggested to use VH instead of %, but changing the HTML BODY to 100vh pushed all the content down (although the background was no longer visible at the bottom). See below - the red represents the background color, and the brown is the image.

All my content fits within the screen. Interestingly, if I rotate the device to landscape mode and then back, everything looks perfect!

I suspect this issue is related to the 'notch' concept - https://css-tricks.com/the-notch-and-css/

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

HTML

<body class="bkground">
<div class="main">
    <div class="wrapper">
        <div class="content" role="main">
            <div class="main-form-container">
                <form id="auth-form" method="post" class="centered">
                   <!-- Content here -->
                </form>
            </div>
            <div class="accept-connect-container">
                <form method="post" class="accept-form">
                   <!-- Content here -->
                </form>
            </div>
        </div>
    </div>
</div>

CSS

@media (min-height: 640px) and (max-height:699px) {
html body {
    height: 100%;
}
.wrapper {
    background-image: url('../img/desktop-background.jpg');
    background-repeat: no-repeat;
    -webkit-background-size: fill;
    -moz-background-size: fill;
    -o-background-size: fill;
    background-size: fill;
    background-position: center;
    background-color: #fff;
    margin: 0;
    padding: 0;
}
.main {
    height: 100%;
}
.content {
    width: 350px;
   }
}

EDIT

I've made some changes to the CSS that seem to have resolved the issue. However, I'm unsure if this fix will cause problems on other devices, although Chrome's responsive tool indicates otherwise. It's a bit tricky to say for sure.

CSS - Replaced % with VH for the BODY and MAIN tag/class heights

@media (min-height: 640px) and (max-height:699px) {
html body {
    height: 100vh;
}
.wrapper {
    background-image: url('../img/desktop-background.jpg');
    background-repeat: no-repeat;
    -webkit-background-size: fill;
    -moz-background-size: fill;
    -o-background-size: fill;
    background-size: fill;
    background-position: center;
    background-color: #fff;
    margin: 0;
    padding: 0;
}
.main {
    height: 100vh;
}
.content {
    width: 350px;
   }
}

Answer №1

By adjusting the min-height and max-height settings, you can ensure proper display.

Set them to either 100% or 100vh for optimal results.

@media (max-height:100%) {
html body {
    height: 100vh;
}
.wrapper {
    background-image: url('../img/desktop-background.jpg');
    background-repeat: no-repeat;
    -webkit-background-size: fill;
    -moz-background-size: fill;
    -o-background-size: fill;
    background-size: fill;
    background-position: center;
    background-color: #fff;
    margin: 0;
    padding: 0;
}
.main {
    height: 100vh;
}
.content {
    width: 350px;
   }
}

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

Having trouble getting CSS animation to work on Mozilla using mozAnimationName?

<style> @keyframes shake { 0% { -moz-transform:scale(0);opacity:0; } 25% { -moz-transform:scale(1.3);opacity:1; } 50% { -moz-transform:scale(0.7);opacity:1; } 75% { -moz-transform:scale(2); ...

Is there a way to preserve the original color format without converting it to RGB

When applying a hsl color in JavaScript, it ends up being converted to RGB instead of staying as an HSL color. document.body.style.backgroundColor = "hsl(0,100%,50%)" document.body.style.backgroundColor; // "rgb(255, 0, 0)" I wanted to set an HSL color a ...

CGRectMake is failing to function properly

Currently, I am experimenting with a project taken from the "iOS Programming Cookbook" which is focused on iOS 7. The task at hand is to generate a UITextField element and integrate it into the ViewController. Within the ViewController.m file, the followi ...

Using JSTL tags may result in returning null or empty values when making Javascript calls or populating HTML

This strange error is puzzling because it appears on some of the webpages I create, but not on others, even though the elements are exactly the same. For instance, this issue does not occur: <main:uiInputBox onDarkBG="${hasDarkBG}" name="quest ...

Leveraging the power of Bootstrap and JavaScript to implement a custom Toast feature

I am utilizing Bootstrap 4 to design Toasts, and I am presently developing a JavaScript function to generate a toast. My attempt to create elements within the JS file did not properly style it. index.html <!doctype html> <html lang="en"> ...

Identify a facial presence when my camera is in use

Seeking guidance on how to develop an app that utilizes a camera view to detect faces. I have successfully implemented face detection on images, but now I need to work with a live camera feed. Here is an overview of my progress: - (void)viewDidLoad { ...

Creating a static CSS lightbox with scrolling content

I am trying to create a CSS lightbox for an image gallery, where the images displayed in the lightbox need to be large so their content is easily readable. The lightbox container is fixed in its position, but I require the images to be scrollable along the ...

Displaying search results from a PHP query in an HTML text box

Within my PHP page, I am populating a table with the results of a query using the following code: <?php $json=file_get_contents("http://www.example.com/myfile.php"); $data = json_decode($json); if (count($data->result)) { echo "<table id= &apos ...

Switching between numerical and alphabetical input using JQuery

How can I switch between allowing character and numeric input in a textbox? I currently have a JQuery function that restricts input to numbers only $('.numeric').on('input', function (event) { this.value = this.value.replace(/[^0 ...

What is the best way to extract a portion of a string starting from a particular character to the end in Swift 4?

I'm currently dealing with a string that contains the path to an image file like this: /Users/user/Library/Developer/CoreSimulator/Devices/Hidden/data/Containers/Data/Application/Hidden/Documents/AppName/2017-07-07_21:14:52_0.jpeg My goal is to extr ...

jQuery modal window extension

Currently, I am utilizing a jQuery popup plugin that opens a popup window using the anchor's href. For example: <a href="/some/site?hello=hi" class="popup">link</a> There could be an unlimited number of these on my page, each pointing to ...

Display the footer once the user has reached the end of the page by scrolling

Below is the footer code I am working with. <div class="row"> <div class="col-md-12"> <div> this section always remains at the bottom </div> </div> <div class="col-md-12"> <div> only v ...

Swap two frames effortlessly with just a single click!

Is there a way to effortlessly change the contents of two frames with just one click? With a single click, I'd like to modify both "framename" and "framename2" by setting their href attribute to 'qwerty' and 'qwerty2' respectively ...

Customize DataTables selector by modifying its frame, font, and alignment

I'm experiencing issues with customizing the page selector in DataTables. Although I managed to change the background color to black, the frame around it remains blue. The font color of unselected pages and the "Next" button also do not reflect the c ...

Retrieve the appended element's object

I am currently facing an issue with accessing elements that are automatically added by a library in my code. In my HTML, I have the following line: <div class="bonds" id="original" style="display:block;"></div> The library appends some elemen ...

Troubleshooting CSS transition issues on ASP.NET Web Forms

Is there a way to make CSS3 transitions work in a .aspx page? I prefer Web Forms for designing forms and any suggestions would be helpful. The following is the code snippet from the .aspx page: <%@ Page Title="" Language="C#" MasterPageFile="~/Sit ...

Tips for moving a title sideways and adjusting the bottom section by x pixels

I am seeking to accomplish a design similar to this using CSS in order to create a title of <h1>DISCOVER <span>WEB 3</span> DIMENSIONS</h1>. How do you recommend achieving this? Thank you, I have searched on Google and asked frie ...

JavaScript not properly rendering CSS styles

If I insert the following HTML statically, the CSS style is correctly applied. HTML: <li class="connector"> <a href="#"> <img src="css/images/temp/connector2.png" alt="" width="192" height="192"> <span class="sr-only"& ...

Combine several svg elements within a single div row using Bootstrap 5

Is there a way to adjust the SVG settings in order to have two of them side by side within a div class="col" element? ...

The checkbox is not updating as anticipated

I'm currently developing a basic widget that allows the user to change the value of either the check box OR the entire div by selecting them. Below is the code I have implemented: $(document).ready(function() { $(document).on("click", ".inputChec ...