How can i get default font size in pixels by using JavaScript or JQuery?

前端 未结 9 1618
Happy的楠姐
Happy的楠姐 2021-02-04 09:07

As you know em is a relative font measurement where one em is equal to the height of the letter \"M\" in the default font size. An advantage in using it is because you will be a

9条回答
  •  無奈伤痛
    2021-02-04 09:42

    If you use rem as unit the default 'font-size' need take from , not from body or other.

    alert(window.getComputedStyle(document.documentElement).getPropertyValue('font-size'))

提交回复
热议问题