Since width: 100%; seems to be well supported, I would suggest either:
#header { width: 100%; padding: 0; margin: 0; } #header img { width: 100%; padding: 0; border: 0; outline: 0; } <div id="header"> <img src="header.png" /> </div>
or
#header img { width: 100%; padding: 0; border: 0; outline: 0; } <img src="header.png" />
setting only width means that the width / height ratio of the image will be saved by the browser. Remember, however, that transferring images (zooming / resizing) to your phone’s browser may result in less significant artifacts.
If you have the ability to use images of different sizes, you can call them using @ media queries :
<link rel="stylesheet" href="mobileStylesheet1.css" media="only screen and (max-device width:840px)"/> <link rel="stylesheet" href="mobileStylesheet2.css" media="only screen and (max-device width:800px)"/> <link rel="stylesheet" href="mobileStylesheet3.css" media="only screen and (max-device width:480px)"/>
And in these style sheets, defining:
mobileStylesheet1.css
#header { background: transparent url(path/to/840pxImage.png) 0 50% no-repeat; }
mobileStylesheet2.css
#header { background: transparent url(path/to/800pxImage.png) 0 50% no-repeat; }
mobileStylesheet3.css
#header { background: transparent url(path/to/480pxImage.png) 0 50% no-repeat; }
source share