如何设置rem的基本大小 [英] How to set base size for rem
问题描述
我有一个简单的问题,您在哪里声明 rem
的基本大小?
I have a simple question, where do you declare the base size that rem
is calculated from?
<body>
<h1>Something</h1>
</body>
我可以看到字体大小
< body>
设置为16px,而< h1>
设置为 3rem
,但是当我期望48px时,字体以30px呈现。
I can see that the font-size
is <body>
is set to 16px and the <h1>
is set to 3rem
, yet the font is rendering at 30px when I'd expect 48px. Can any parent redefine the base?
推荐答案
rem
表示根元素的字体大小(通常< html>
)。
在根元素font-size中使用时,表示其初始
值(常见的浏览器默认值为16px,但用户定义的首选项
可能会对此进行修改)。
Represents the font-size of the root element (typically <html>
).
When used within the root element font-size, it represents its initial
value (a common browser default is 16px, but user-defined preferences
may modify this).
换句话说,更改字体大小> html
元素, rem
的计算基础将发生变化。
In other words, change the font size of your html
element, and the calculation base for rem
will change.
这篇关于如何设置rem的基本大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!