Material-UI-了解10px的简化 [英] Material-UI - understanding 10px simplification
本文介绍了Material-UI-了解10px的简化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不明白为什么我们需要这样做以简化10px:
I don't get why we need to do this for the 10px simplification:
html {
font-size: 62.5%; /* 62.5% of 16px = 10px */
}
不应该执行以下代码来完成所有工作吗?
It wasn't supposed to the following code do all the work?
const theme = createMuiTheme({
typography: {
// Tell Material-UI what's the font-size on the html element is.
htmlFontSize: 10,
},
});
谢谢.
推荐答案
主题中typography
的htmlFontSize
属性无法控制 html
元素的字体大小;它只是告诉Material-UI您在其上使用了什么尺寸.然后,Material-UI使用该大小来控制
The htmlFontSize
property of typography
in the theme does not control the font-size of the html
element; it just tells Material-UI what size you used on it. Material-UI then uses that size to control how it converts px units to rem units when determining the font sizes for all the different typography variants.
这篇关于Material-UI-了解10px的简化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文