Mobile End Unit Resolution

Source: Internet
Author: User

What does a mobile-phone development unit use?

There are currently 3 species, Px,em, rem

Most of the PC is in PX units, a small part with EM units, and mobile, please use all REM units. Most devices today, including but not limited to iOS 5+, Android 2.3+, Window Phone 8+, are compatible.

What is REM?

Relative length units, relative to the root element (that is, the HTML element) Font-size a multiple of the value.

REM usage is simple: After the root tag HTML is set to text size (not set, most browsers default to 16px), other tags set rem are multiples of the HTML size.

html{

font-size:10px; /* Set HTML to 10px */

}

h1{

Font-size:2rem; /* 10px*2=20px */

}

So why should the mobile end use REM as a unit? First, I started to mention that the majority of mobile support, do not need to consider compatibility issues, the second is flexible to modify. If you want the entire page font to be twice times larger, modify html{font-size:20px} directly.

You will certainly say, Baidu Google search out of the article, most of it is let set to html{font-size:62.5%}. His role is to set the HTML to 10px, but in case which browser 2b upgrade to the default text size is not 16px what to do? And can be directly set to 10px, why to use 62.5% to calculate 10px? It's not about taking off your pants, farting? So I was set directly 10px. -----------(10px) ÷ (16px) x100% = 62.5%

If I only introduce this thing, I will not write this article if I search a lot of internet. The key is the large-scale use of the bug, but also the egg-ache native chrome ... Chrome on the iOS platform is no problem, it is said that all browsers in iOS are shells ...

Mobile End Unit Resolution

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.