English 中文(简体)
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?

最佳回答

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.

问题回答

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.

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.





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签