Font size in CSS - % or em?

后端 未结 8 1850
走了就别回头了
走了就别回头了 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:47

    Regarding the difference between the css units % and em.

    As far as I understand (at least theoretically/conceptually, but possibly not how these two units might be implemented in browsers) these two units are equivalent, i.e. if you multiply your em value with 100 and then replace em with % it should be the same thing ?

    If there actually is some real difference between em and % then can someone explain it (or provide a link to an explanation) ?

    (I wanted to add this comment of mine where it would belong, i.e. indented just below the answer by "Liam, answered Sep 25 '08 at 11:21" since I also want to know why his answer was downvoted, but I could not figure out how to put my comment there and therefore had to write this "thread global" reply)

提交回复
热议问题