px, em, rem and the difference between% and summarized

px This unit comes with very much, I believe we are familiar with. Px is the name of the unit pixels, which is a unit of fixed size, is calculated for the pixel (PC / mobile phone) screen, a pixel (1px) is a point on the (computer / mobile phone) screen, i.e. a screen resolution minimum cut. Because it is a fixed-size units, it alone web design, if the big screen adaptation (computer), on a small screen (mobile phone) will be very friendly and can not do adaptive effect.

 

  1. px is a fixed length, does not vary with changes in other elements
  2. em and% relative to the parent element unit, father property level elements (font-size, or other attributes) changes vary
  3. rem is relative to the root (HTML element), it will vary with all the attributes of HTML elements (font-size) Change
  4. px% and more widely used, we could act as more property units, and rem em is the font and size of the unit, the unit acts as a font-size property
  5. General: 1em = 1rem = 100% = 16 px

Guess you like

Origin www.cnblogs.com/dingboyang/p/10990639.html