What is the best way to ensure a footer works on both a PWA and browser on a page?

Developing a Progressive Web App (PWA) has presented numerous challenges, particularly in ensuring responsiveness.

In an attempt to create a footer for the page, I defined the following classes:

#root {
 height:100vh;
}

.provider-container {
    padding: 3rem 1rem 4rem 1rem;
    height: 90%;
    border-radius: 0 0 1rem 1rem;
}

.footer{
    position: absolute;
    bottom: 0;
    right:0;
    left:0;
    height: 4rem;
    background: white;
}

This is the structure of my HTML:

<body>
 <div id="root">
  <div>Some content....</div>
  <div className="footer">footer</div>
 </div>
</body>

Everything seems to function as expected during debugging. The intention was to match the height of the footer with the padding-bottom of the container to ensure proper fit. When adding the app to the homescreen and launching it, everything works seamlessly. However, when accessing the page through a browser, the container overflows its boundaries. Certain content gets obscured by the footer, almost blending in with the browser's own viewport/footer. The accompanying image provides visual clarification. While adjusting the page's content size or margins could be a quick fix, this would negatively impact the appearance when opening the app directly without the browser interface.

Any suggestions or solutions?

https://i.sstatic.net/DMcZD.png

Answer №1

There appears to be content overlapping with the footer, giving the impression that the footer is part of the viewport.

This behavior is expected when an element is set to absolute. It no longer follows the flow of the DOM layout, causing it to stay in place even when the rest of the content scrolls.

The discrepancy in behavior may be due to differences in window size or viewport settings in a Progressive Web App (PWA) environment.

The screenshot provided seems to be from a laptop/desktop view. Double-check that the viewport width is consistent across both scenarios.

If you prefer the footer to scroll along with the rest of the page content, you can achieve this using JavaScript.

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

SortTable - Refresh Dropdown Filter in Header After Adding Row to Table

My tablesorter table initially displays two entries in the "License" Filter. https://i.sstatic.net/4XODb.png If I dynamically add a row, the table now looks like this: https://i.sstatic.net/vMMYc.png I have attempted to update the table using the follow ...

How to eliminate the hashtag from the slug while referencing an element by its id in Next.js

Is there a way to eliminate the # from the URL when referencing an element by its id (changing domain.com/#contact to domain.com/contact)? For example, if you click this link: <Link href="about"><a>Contact</a></Link>, the ...

Can the mDNS string received through webRTC be decoded to retrieve a user's IP address?

After doing some thorough research, I came across this insightful response from a different Stack Overflow question. The problem at hand involves retrieving an mDNS string, which looks like this: abcd1234-1e1e-1e1e-1e1e-abcd1a2bc3de.local I have a genuin ...

Unlocking the Power of Marionette.CompositeView: Passing Parameters to Marionette.ItemView

Is there a way to access the app.vent from Marionette.ItemView? One solution might be to pass a parameter (app.vent) to Marionette.ItemView from Marionette.CompositeView. Here's the code snippet: // view/compositeView.js define([ 'marionet ...

Add two cells below a header with a colspan of one

I've been having trouble grouping the cells with the values { Lazy, Dog, Then, It } under a single header (with a colspan of 1) So far, I've attempted using div tags within the cells, creating multiple cells, and trying various combinations of w ...

I am experiencing an issue with my divs displaying an undesired white border on mobile screens

Having a challenge with the layout of my website when viewed on mobile devices or in Chrome's developer mobile tools. The two divs at the top of the page are producing a thin white border, which is not visible in regular browser view. Initially faced ...

Guidelines for triggering the update of radio buttons within a Webix datatable

Is it possible to automatically update the Webix datatable when radio buttons are selected? Here is an example of a datatable: var list = [{ id:1, user:"", mail:"", rad:'' }, { id:2, user:"", mail:"", rad:'' }, { id:3, user:" ...

What is the solution to preventing Prettier in VS Code from breaking up CSS Selectors onto different lines?

I am trying to achieve this code style: h1,h2,h3,h4,h5 { font-weight: 400 !important; } However, Prettier - Code Formatter is splitting each selector into separate lines like this: h1, h2, h3, h4, h5 { font-weight: 400 !important; } The issue of CSS ...

The div element on the HTML page is not displaying all of its content

I've created the following code snippet on JSFiddle. https://jsfiddle.net/msridhar/1zvhmpjq/11/ HTML file: <body> <div id="headerDiv"> <img id="headerImg" src="" width="280" height="125" alt="DummyLogo"/> <pre id ...

Avoiding unauthorized cookie access via browser console

Is it possible to prevent unauthorized access to the value of cookies using document.cookie from the browser's console? What security measures can be implemented to secure the cookies? https://i.sstatic.net/gUmSb.png ...

Steps to create spaces between the bootstrap cards

Just diving into Bootstrap and attempting to incorporate images as cards, I encountered a challenge where the cards were piling up one after another without any spaces between them. Below is the code snippet utilizing Bootstrap4: <body> <div class ...

Having trouble with jQuery find and attribute selectors?

On my webpage, there is a form where: The command $('form').find('input[type=submit]') returns [undefined] However, using $('form input[type=submit]') works correctly... Is this behavior expected? ...

IE6 disrupts stored layouts

I've encountered a strange issue with my design in IE6. It loads perfectly at first, but after reloading it a couple of times, everything suddenly collapses. The strange part is that when I upload an updated version, it fixes the issue, only to break ...

While working in create-react-app, I encountered an issue where my component failed to compile due to a static arrow function returning undefined

I've encountered an issue with my React component. Although I am using create-react-app, which is supposed to support static class fields, I am facing a compilation error that says: ./src/scenes/Settings/components/UserSettings.js Line 7: 'o ...

Exploring Node.js Express: Understanding the Difference Between Modules and Middleware

I am working on an express rest api and need to create a PDF document with a link to download it. I have successfully generated the PDF, but now I want to create a route specifically for returning the PDF link. In addition, I also need other routes that ...

A duo of Antd forms within a single component

Having two antd forms in a single component can be tricky. The first form is used for user registration, gathering information like first name, last name, email, etc. Upon submitting this form, a modal with another form is opened for phone number verificat ...

Loop through the JSON data and display any empty strings

I encountered an issue while trying to convert an object string from a list of arrays using the JSON.parse method. Despite successfully converting the object string to an object, it appears empty when used within ng-repeat. Jade .item.col-md-4(ng-repeat= ...

Send a bundle of data through AJAX requests

An issue has been encountered on an HTML/PHP page named sucessful.php where a variable job_id passed from another page is not being received by the destination page interview.php. The problem arises when attempting to transfer two variables and their corr ...

Iframe form submissions

I am interested in accomplishing the following task. My objective is to submit a form to my booking engine and show the results on either a new page or within a Div element. Ideally, when the user clicks the submit button, it would display an Iframe or re ...

What could be causing the CSS border to not show up on the webpage?

I am trying to add a border to the footer, but it seems like something is blocking it from showing properly. Below are the CSS lines I have used: position: fixed; bottom: 0; right: 0; left: 0; clear: both; line-height: 1.36em; padding: 08px 0px 0px; tex ...