views:

3904

answers:

3

How do I go about making an image or section of the page full screen on the iPhone?

I have an image that is 480 x 320 and I want to pull that up full screen on the iPhone but it has to be within a webpage so that I can make the image a link back to the previous page.

Currently if I drop the image on a blank page and I open it up on the iPhone it just shows up in the top left corner.

+5  A: 

I'd say set the viewport meta tag in your blank page so Safari knows to render the page at the right size. For more information, see this link:

Apple iPhone Safari Documentation

andyjeffries
+11  A: 

Hopefully I'm not in breach of the NDA here, but here goes.

Mobile Safari, by default, renders a page as if that page had been viewed by a desktop browser, with a default width of 980 pixels.

To change this behavior you need to explicitly declare the viewport, which you do via meta tags. If you declare the width to the constant device-width, it'll default to 320 instead of 980, and everything looks great.

<head>
    <meta name="viewport" content="width=device-width,user-scalable=no" />
</head>
Hans Sjunnesson
+2  A: 

nice links which may help you further:

How to optimize your website for mobile devices: http://solutions.treypiepmeier.com/2008/12/01/optimizing-a-website-for-iphone/

iPhone Web App Example Code http://dotnetperls.com/Content/iPhone-Web-App.aspx