我不明白为什么我们需要这样做以简化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,
},
});
先谢谢您。
typography
属性执行[[not control html
元素的字体大小;它只是告诉Material-UI您使用了什么尺寸。然后,Material-UI在确定所有不同印刷字体变体的字体大小时,使用该大小来控制大小converts px units to rem units。