Is there such a thing as min-font-size and max-font-size?

前端 未结 11 574
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 22:13

I\'m trying to make a font in a div responsive to the browser window. So far, it has worked perfectly, but the parent div has a max-width of 525px. Res

11条回答
  •  -上瘾入骨i
    2021-01-29 22:22

    Please note that setting font-sizing with px is not recommended due to accessibility concerns:

    "defining font sizes in px is not accessible, because the user cannot change the font size in some browsers. For example, users with limited vision may wish to set the font size much larger than the size chosen by a web designer." (see https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)

    A more accessible approach is to set font-size: 100% in the html, which respects user default size settings, and THEN using either percentages or relative units when resizing (em or rem), for example with a @media query.

    (see https://betterwebtype.com/articles/2019/06/16/5-keys-to-accessible-web-typography/)

提交回复
热议问题