Mobile Development Summary

Source: Internet
Author: User

Http://www.zhangxinxu.com/wordpress/2012/08/mobile-wap-page-knowledge-share/

Browser and picture display

Vertical state, such as iPhone4, Width pixel 640, and general Symbian S60 width 320. Due to the reading experience, the IPhone4 and Symbian default browsers have a layout viewport width of 320 pixels, so iphone4 has a device pixel ratio of devicepixelratio to 2 and Symbian 1.

The problem is that the actual 320 pixel width of the picture on Symbian is normal proportional width full screen display, but on the IPhone4, is also full width screen, but the picture is actually twice times stretched, so if the picture itself is not high quality, there will be blurred stretching- The retina screen of the iphone does not work well.

If you do not cost, you can make two sets of pictures, respectively, using the Language HD screen and the normal screen. However, the above "device pixel than Devicepixelratio" also mentioned, some devices pixel ratio is 2.25 , may also appear in the future pixel ratio 3 , therefore, this multi-size picture, development and maintenance costs, and not necessarily longevity of the method is worth discussing.

. Icon {  background-image:url (example.png);/* Normal size picture */  background-size:200px 300px;  height:300px;  width:200px;} @media only screens and (-webkit-min-device-pixel-ratio:1.5), only screens and (-moz-min-device-pixel-ratio:1.5), only Screen and (-O-MIN-DEVICE-PIXEL-RATIO:3/2), only screen and (min-device-pixel-ratio:1.5) {  . icon {    Background-image:url ([email protected]); /* twice x size picture */  }}

If you want to save trouble, you can use the HD version of the picture, for 320 pixel width, device pixel ratio of 1 devices, using the 1/2 size compression limit, or use background-size for general size display. For example, we use a 640 pixel width picture, using CSS (eg. img { width: 320px; } ) Limit to 300 pixels wide. Similar to the Nokia Symbian machine there is a waste, but the iphone and recent Android devices like the display is OK.

If you want to be compatible with OSS browser, background-size use it carefully.

Of course, the best way is to avoid the use of pictures, especially shading, decorative icons, edge corners of the graphics and so on. We can use CSS3 font-face graphics generation, or SVG vector images, or canvas drawings. If the value of the smart machine is considered, the above technology is very OK.

Mobile Development Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.