Px:
Pixel (pixel) relative length units, pixels are relative to the display screen resolution
Em:
Relative length unit, relative to the font size of the text within the current object. If the current font size for inline text is not considered set, the default font size relative to the browser
1, the value of EM is not fixed
2, EM inherits the font size of the parent element
P{font-size:2em;}
A{font-size:2em;} < P >< a > We're All good kids. </a></p>
Equivalent to:
A{font-size:4em;} < P >< a > We're All good kids. </a></p>
Div{font-size:2em;} P{font-size:2em;} A{font-size:2em;} < Div > < P > < a > We're All good kids. </a> </p> </div> equal to: a{font-size:8em;} (2*2*2=8)
Rem:
CSS3 a new relative unit (root em, root em)
When REM sets the font size for an element, it is still relative in size, but relative to the HTML root element
Advantage: It can adjust all font sizes proportionally, and avoid the chain reaction of font size lamination
Currently, in addition to IE8 and earlier versions, all browsers support REM, and if not supported, write an absolute unit declaration, then these browsers will ignore the REM-set font size
p{ font-size:14px; Font-size:0.875rem;}
Pt:
Commonly used in the printing industry, the meaning of the pound, generally for page printing and typesetting
Conversion:
PX to em:12px/16px=0.75em;
PX to%:12px/16px*100=75%;
px to pt:16px* (72pt/96px) =12pt;
EM to px:0.75em*16px=12px;
Conversion tools
http://pxtoem.com/
px, EM, REM,% units