The use of sprite diagrams on the mobile side

Source: Internet
Author: User

When you make a mobile page, the tiles in the design are often twice times the actual size of the picture, and here are some tips on how to display the image as normal.  

When the picture is a single sheet, you can design the actual size of the container, and then set the Background-image, in order to reduce the picture one times, you can set background-size:contain;

such as: Picture size is 20*20, but on the mobile side of the page is displayed 10*10, at this time, the container is set:

#contain{width:10px;Height:10px;background:URL (images/xx.png) no-repeat 0 0;background-size:contain;} 

When the picture is not a single sheet, but a sprite diagram, you first need to be easy to set the size of the picture, and then use Transform:scale (0.5) to zoom one time.

#contain{width:20px;Height:20px;background:URL (images/sprite.png) no-repeat-200px 0;Transform:Scale (0.5);-webkit-transform:Scale (0.5);-ms-transform:Scale (0.5);-o-transform:Scale (0.5);} 

The use of sprite diagrams on the mobile side

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.