I'm developing my first mobile site. The design is pretty simple - almost no graphics. There's a page that allows users to search for retirement communities by zip code. The search results page is just a list of communities found, with links to open an individual community page for each.
All works file, EXCEPT... the client now 开发者_JS百科wants to feature an image of each community on the specific page for that community. The image needs to span the entire width of the screen, regardless of whether the user is viewing in portrait or landscape mode, and it needs to work the same way on both iPhone and android browsers.
How do I specify image size so that it works this way?
Edited to add: I do have a viewport tag already, but although it's correctly setting the size of text and HTML/css elements, it's not having any effect on the images.
<img src="source" width="100%" />
or
<img src="source" style="width:100%" />
or
<style>
.full
{
width: 100%;
}
</style>
<img src="source" class="full" />
should do the job;
Try using
.img {
max-width: 100%;
}
Try this; It seems to work for iPhone and Blackberry – not great for android though – by adding a width and height on the body tag to the size of the image. The mobile browsers will then zoom in to the image size.
精彩评论