Ped*_*vas 7 css themes font-size reactjs material-ui
我不明白为什么我们需要这样做来简化 10px:
html {
font-size: 62.5%; /* 62.5% of 16px = 10px */
}
Run Code Online (Sandbox Code Playgroud)
下面的代码不应该完成所有的工作吗?
const theme = createMuiTheme({
typography: {
// Tell Material-UI what's the font-size on the html element is.
htmlFontSize: 10,
},
});
Run Code Online (Sandbox Code Playgroud)
先感谢您。
主题中的htmlFontSize属性不控制元素的字体大小;它只是告诉 Material-UI 你在它上面使用了什么尺寸。Material-UI 然后使用该大小来控制它在确定所有不同排版变体的字体大小时如何将 px 单位转换为 rem 单位。typographyhtml
| 归档时间: |
|
| 查看次数: |
833 次 |
| 最近记录: |