A way to correct background scaling in iPad's Safari?

前端 未结 6 1935
醉酒成梦
醉酒成梦 2021-01-31 09:45

I have a website using a huge background image (2000x1500) in a div container (100% x 100%).

When I open that site on Safari on an iPad it gets scaled down (~40%) in a d

6条回答
  •  感动是毒
    2021-01-31 10:20

    You can use the solution of @UXdesigner to create a seperated stylesheet for iPad. But you can use a single statement in your current stylesheet:

    @media only screen and (max-device-width: 1024px){
      .yourClassname{
        max-width: 500px;
      }
    }
    

    and of course for smaller devices like phones you can use:

    @media only screen and (max-device-width: 480px){
      .yourClassname{
        max-width: 100px;
      }
    }
    

    Note that these suggestions only work in CSS3 (the latest devices all accept this)

提交回复
热议问题