在根级别使用时,rems 和 ems 是否等效?
Are rems and ems equivalent when used at root level?
来自 我看到规范中 rem
的定义是什么:
rem unit
Equal to the computed value of font-size
on the root element. When specified in the font-size
property of the root element, or in a document with no root element, 1rem
is equal to the initial value of the font-size
property.
而em
的定义是:
em unit
Equal to the computed value of the font-size
property of the element on which it is used.
对我来说,这意味着 1em == 1rem
在 :root
中使用时的定义。
我说得对吗?
是
:root {
font-size:40px;
border-top: 1rem solid red;
border-bottom:1em solid green;
}
来自 rem
的定义是什么:
rem unit
Equal to the computed value of
font-size
on the root element. When specified in thefont-size
property of the root element, or in a document with no root element,1rem
is equal to the initial value of thefont-size
property.
而em
的定义是:
em unit
Equal to the computed value of the
font-size
property of the element on which it is used.
对我来说,这意味着 1em == 1rem
在 :root
中使用时的定义。
我说得对吗?
是
:root {
font-size:40px;
border-top: 1rem solid red;
border-bottom:1em solid green;
}