Are rems and ems equivalent when used at root level?

72 Views Asked by At

From this answer I see what's the definition of rem in the spec:

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.

And the definition of em is:

em unit

Equal to the computed value of the font-size property of the element on which it is used.

To me this implies that 1em == 1rem by definition when used at :root.

Am I correct?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes

:root {
  font-size:40px;
  border-top:   1rem solid red;
  border-bottom:1em  solid green;
}