Css3:rem units

Source: Internet
Author: User

PX: Relative to the display screen resolution

EM: The font size relative to the parent element

REM: Font size relative to root node (i.e. HTML tag)

Browser default font Size: 16px

{font-size:62.5%; /* 10÷16x100% = 62.5%   is only convenient for calculation, but chrome now minimum font size 12px can be directly with PX, set font-size:20px; then 1rem is 20px*/}  {font-size:1.4rem;  /**/}

Compatibility:

All browsers have REM support in addition to IE8 and earlier versions. For browsers that do not support it, the REM-set font size is ignored, and a statement of absolute units can be written at this time. Therefore consider compatibility, generally using PX, or PX and REM combination

Why is REM used on many web apps?

(1) Trouble with no EM multiple calculations

(2) make the mobile font and spacing self-adapting

A, the most common use of the mobile is, the front of a script, calculate the size of the current device, according to the size of the dynamic definition of the root element font size, so that the elements of the page definition can be adaptive changes

B, Media Inquiry method

{ HTML {font-size: 30px;}  }
{ HTML {font-size: 15px;} }
{ HTML {font-size: 13px;} }

Css3:rem units

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.