Font size in CSS - % or em?

后端 未结 8 1849
走了就别回头了
走了就别回头了 2020-11-28 02:24

When setting the size of fonts in CSS, should I be using a percent value (%) or em? Can you explain the advantage?

8条回答
  •  我在风中等你
    2020-11-28 02:36

    The real difference comes apparent when you use it not for font-sizes. Setting a padding of 1em is not the same as 100%. em is always relative to the font-size. But % might be relative to font-size, width, height and probably some other things I don't know about.

提交回复
热议问题