logoalt Hacker News

lapcattoday at 12:08 PM2 repliesview on HN

I would add this:

  <meta name="viewport" content="width=device-width, initial-scale=1">
All you need is initial-scale=1, not width=device-width, which is redundant.

"You do not need to set every viewport property. If only a subset of the properties are set, then Safari on iOS infers the other values. For example, if you set the scale to 1.0, Safari assumes the width is device-width in portrait and device-height in landscape orientation." https://developer.apple.com/library/archive/documentation/Ap...

I've confirmed the behavior in testing.


Replies

phil-pickeringtoday at 1:34 PM

The latest MDN recommendation is to use only width=device-width, with initial-scale being mostly redundant.

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

netoltoday at 12:18 PM

This may be Safari-specific? Google recommends setting both: https://developer.chrome.com/docs/lighthouse/best-practices/...

show 1 reply