How to set viewport only for iphone or ipad?

后端 未结 8 1158
忘了有多久
忘了有多久 2021-02-01 07:38

I have a website that needs to use 0.3 value for viewport on iphone, but 0.7 for ipad.

Is there a way to set viewport for only iphone or ipad?

8条回答
  •  半阙折子戏
    2021-02-01 08:15

    If you need to set different viewport, based on the device(iPhone/iPad), you need to set the viewport using device-width

    
    

    What the above statement will do is set a viewport of 320px on iPhone and 768px on the iPad..Guess that is what woudld translate into 0.3 and 0.7 u are looking for..

    This worked but only after I realized that this line does not go in the ... section! Dumb of me, but maybe needs to be said.

    Thanks!

提交回复
热议问题