Consider the following rudimentary html code:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>iPad test</title> <meta name="viewport" content="width=device-width"> <style> body { margin:0; } #content { margin: 0 auto; width: 980px; border:1px solid #c4c4c4; background-color:#f5f5f5; } </style> </head> <body> <div id="content"> A small amount of content </div> </body> </html>
When viewed on an iPad, the main 980px content area will not automatically scale to fit the iPad screen. However, if you replace A small amount of content with a large amount of content, that is ... enough to cause vertical scrolling, the page automatically scales to iPad.
Does anyone know why this is? I searched high and low and cannot find a way to make auto scaling occur when there is minimal content on the page.
Changing the contents of the viewport to width=980 fixes the problem, of course, however I am creating a responsive website, so viewport should be device-width .
I am using a media query to change the CSS for the content area on smartphones (up to 100% width), and I was hoping to use the standard desktop version of the website for iPads.
Any ideas would be highly appreciated.
Note. I am testing an iPad with a retina display, I am not sure what is happening on older models.
source share