Here is a minimal example of the CSS footer trick:
body {
margin: 0;
font-size: 1rem;
}
#wrapper {
display: grid;
grid-template-rows: auto 1fr auto;
height: 100vh;
/* make the font size a little bigger */
font-size: 2rem;
font-family: Helvetica, Arial, sans-serif;
width: 100vw;
grid-template-columns: 1fr;
}
header, footer {
text-align: center;
}
<div id="wrapper">
<header>This is the header</header>
<main>This is the main content</main>
<footer>This is the footer</footer>
</div>
If you open this up in a desktop browser, it works as expected. However, in every mobile browser I tested (Chrome, Firefox, Safari), the footer is invisible (you have to scroll to see it). Why is this the case?
Note that if you're trying out this example on desktop with developer tools device emulator, try setting the display size to iPhone 12 Pro and Zoom to 100% instead of using the "Responsive" device. This will best show how it actually looks on mobile.
EDIT: it does work properly on mobile Firefox, which begs the question why it doesn't on Chrome and Safari