CSS: 100% font size - 100% of what?

前端 未结 9 693
梦毁少年i
梦毁少年i 2020-11-30 17:35

There are many articles and questions about percentage-sized vs other-sized fonts. However, I can not find out WHAT the reference of the percent-value is supposed to be. I u

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-30 17:57

    My understanding is that when the font is set as follows

    body {
      font-size: 100%;
    }
    

    the browser will render the font as per the user settings for that browser.

    The spec says that % is rendered

    relative to parent element's font size

    http://www.w3.org/TR/CSS1/#font-size

    In this case, I take that to mean what the browser is set to.

提交回复
热议问题