Material-UI-理解10px简化

问题描述 投票:2回答:1

我不明白为什么我们需要这样做以简化10px:

html {
   font-size: 62.5%; /* 62.5% of 16px = 10px */
}

不应该执行以下代码来完成所有工作吗?

const theme = createMuiTheme({
  typography: {
    // Tell Material-UI what's the font-size on the html element is.
    htmlFontSize: 10,
  },
});

先谢谢您。

css reactjs themes material-ui font-size
1个回答
2
投票
htmlFontSize的typography属性执行[[not control html元素的字体大小;它只是告诉Material-UI您使用了什么尺寸。然后,Material-UI在确定所有不同印刷字体变体的字体大小时,使用该大小来控制大小converts px units to rem units
© www.soinside.com 2019 - 2024. All rights reserved.