Responsive website on iPhone - unwanted white space on rotate from landscape to portrait

前端 未结 12 1578
挽巷
挽巷 2020-11-29 22:21

I am creating a responsive website, and have just noticed a strange behaviour in my content pages when viewed on the iPhone. It scales correctly when loaded in portrait mode

12条回答
  •  情书的邮戳
    2020-11-29 23:07

    I'd like to add to Navneet Kumar's solution because it worked for me. Any div tag styled with width=100% cannot also have left or right padding. The mobile browsers (I noticed the problem on iPhone and Android devices) interpret the div as having a width greater than 100%, thereby creating the extra space on the right side. (I knew this regarding fixed widths, but not percentage widths.) Instead, use width=auto in conjunction with padding.

提交回复
热议问题