Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is viewport-fit=cover no longer working on the iOS Safari?

I wish to use 100% screen width on iOS Safari for my website's header on a notched iOS/Android device and to achieve that I added the following viewport meta_tag on my page <head></head>:

<meta name='viewport' content='initial-scale=1, viewport-fit=cover'>

Then on <header> element of my page I specified a css width of 100% (or 100vmin). I don't need to use env(safe-area-insets) padding on any of my webpages because they are styled in a particular way.

This is pretty much how Apple has described the iOS Safari web api for the notched iPhones on their official documentation but it doesn't seem to be working!

Am I missing something?

Edits: I'm on iOS Safari 13.3.1 on a iPhone 11 Pro Max.

like image 731
Marvin Danig Avatar asked Feb 10 '20 16:02

Marvin Danig


People also ask

What is viewport fit cover?

Use `viewport-fit=cover` to fill the whole screen.

What is the default viewport width size for Apple devices?

Default Viewport Settings The default width is 980 pixels. However, these defaults may not work well for your webpages, particularly if you are tailoring your website for a particular device.

What is Shrink to fit in HTML?

Shrink to Fit - Sheet Size maximizes the usage of the paper size during calculation of the scaling factor. However, because of the layout of the content in the original document, the scaling may not produce the desired result. Clipping of the content may occur.


1 Answers

As of late 2019 Apple is now recommending to use a @supports(padding:max(0px)) { env() } query to detect and fix the notched environment for your website, like so:

@supports(padding:max(0px)) {
    body, header, footer {
        padding-left: min(0vmin, env(safe-area-inset-left));
        padding-right: min(0vmin, env(safe-area-inset-right));
    }
}

The query above and css is discussed at length over here.

like image 85
Marvin Danig Avatar answered Sep 28 '22 01:09

Marvin Danig