Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to position elements absolute bottom if viewing on iOS Safari 15?

I have a screen height of 100vh with an element that is positioned in the bottom corner of the viewport.

If the user views on the latest iOS Safari, the search bar by default covers up that element.

Is there a way to adjust the position based on this particular browser?

like image 450
stevensunsunsun Avatar asked Jan 20 '26 17:01

stevensunsunsun


2 Answers

You want the browser to dynamically adapt to the rendered space. To do so, you should use the dvh unit instead of the vh unit.

This unit get updated whenever the browser rendering space get updated (you have an equivalent for all basic viewport units : dvw, dvmin, dvmax).

like image 197
Rémi Bernard Avatar answered Jan 22 '26 08:01

Rémi Bernard


You can use env(safe-area-inset-bottom), which represents the search bar on iOS. This is by default set to 0.

Read more: https://developer.mozilla.org/en-US/docs/Web/CSS/env

body {
     padding-bottom: env(safe-area-inset-bottom);
}
like image 29
Sigurd Mazanti Avatar answered Jan 22 '26 07:01

Sigurd Mazanti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!