In iOS Safari, when you scroll to the bottom of a web page, you are able to sort of "lift" the page up by trying to scroll again. I assume this is to assure the user that they have reached the end of the page. This area is empty and white by default. Is there a way to style this area with CSS? I'd like to add a background image if only to add flair. As everyone else is asking how to prevent the overscrolling I wanted to know if I could actually use it for something.
I tried adding a background image to the body tag and fixing it to the bottom but it wasn't visible through the overscroll. I feel like it might be impossible as it is part of Safari itself, and the webpage (and its control) has already ended.
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area. It's a shorthand for overscroll-behavior-x and overscroll-behavior-y .
To do this (in Chrome, Firefox, and Edge), we can add the CSS property overscroll-behavior: contain to the overflow: auto element. This will prevent the "scroll chaining" behavior, which will, in turn, keep the mouse-wheel active within the target element.
Go to Settings and tap Accessibility. Turn on the feature, then use the slider to select a sensitivity level.
I know this is an old topic but it still came up first on my search results.
As of lately safari uses the "theme-color" meta tag for this.
For example if you use multiple themes:
<meta name="theme-color" content="#f6f8fa" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#161b22" media="(prefers-color-scheme: dark)">
A few years later and I have found that this is (sort of) possible, using fixed positioning and z-indexes. Assuming your content height is greater than your screen height and your content is wrapped in a div, if you put something in another div with the following class it should appear in the iOS overscroll area:
.ios-peek {
position: fixed;
z-index: -1;
bottom: 0;
left: 0;
}
And here is a proof-of-concept page which seeks to accomplish this even with content that is shorter than the screen height:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<style>
* {
margin: 0;
}
#content {
min-height: 100vh;
height: 100%;
background-color: #fff;
}
#bottom-text {
position: absolute;
bottom: 0;
}
.ios-peek {
position: fixed;
z-index: -1;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<div id="content">
<h1>Blah</h1>
<p>Blah blah blah blah blah blah blah blah blah...</p>
</div>
<div id="bottom-text">
<h3>You're at the bottom, nothing else to see...</h3>
</div>
<div class="ios-peek">
<h1>hi there</h1>
</div>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With