开发者

What is the design best practice for setting the page width for mobile web pages?

Different browsers on different phones have different screen resolution.

Is there a best practice in the community to set the width to a standard size, so that it works on most moderns phones and browsers?开发者_如何学编程


There's no easy way to ensure pixel-perfect accuracy across mobile browsers (actually, there's no easy way to do that with any browser). There are, however, some methods to help with that kind of work. For example, mobile Safari for the iPhone supports a 'viewport' meta tag that allows you to specify attributes like width. Here are some examples of usage:

<meta name="viewport" content="width = 750px" />

<meta name="viewport" content="initial-scale=2.5, user-scalable=no" />

Apple has some information here, and you'll find a lot more information across the web.


IMHO the best practise is to get along without too many assumptions about width and resolution of the clients device.

Mostly those devices have browsers geared towards displaying/flowing/reducing webpages. If at all possible, let the browser do the work.


G'day,

I know you're question is to decide on making a selection of the optimum screen size to work on all phones but that approach soon wears thin with users.

A large web site I'm associated with takes the UserAgent string and normalises it to a common denominator, e.g. over 300 different UA strings in use in the UK for a particular Sony Ericsson phone type so they all get converted to the same string, and then does a lookup into a table to determine screen real estate.

The coders also have access to the current connection speed which is deduced by a geolocation application based on connection type, routing type, etc. at the time of the request. You don't want to be sending rich, high-def media to someone with a slow connection.

This is then used to

  1. decide if rich content can be served, and then
  2. select the optimum format for the content.

HTH

cheers,


You could always use "ems" instead of pixels they should scale properly.

This is still a touchy subject since many mobile browsers basically interpret what you have depending on how the devs wanted to make it interpret.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜