Conversion rate of pt, em, px, percent, other

前端 未结 4 2127
余生分开走
余生分开走 2020-12-15 09:26

More so than less I run into times when I need to use pt instead of px or em instead of pt, or whatever the case, and trying to find the right size for something bigger than

4条回答
  •  遥遥无期
    2020-12-15 09:57

    Well,

    12pt = 16px = 1em = 100%

    assuming you don't change the font size on the body (else the pt will be different), the dpi of your OS is set at 72 etc etc..

    The relationship looks like:

    pt = 3/4*px
    
    em = pt/12
    
    % = pt*100/12
    

    in this case. It's worth pointing out that using pt is wrong, unless you are printing something, and that using px, % or em is more usual.

    Personally, I just use px or em. Using % or em is handy for designs where the base font size changes for smaller screens.

提交回复
热议问题