我不明白为什么我们需要为 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,
},
});
先感谢您。
最佳答案
htmlFontSize
typography
的属性(property)在主题中做 不受控制 html
的字体大小元素;它只是告诉 Material-UI 你在它上面使用了什么尺寸。 Material-UI 然后使用该大小来控制它的方式 converts px units to rem units在确定所有不同排版变体的字体大小时。
关于css - Material-UI - 理解 10px 简化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60112664/