Adam Zerner
Adam Zerner

Reputation: 19238

What is the "root element" for rem?

W3 says:

Equal to the computed value of font-size on the root element. When specified on the font-size property of the root element, the rem units refer to the property’s initial value.

What is this "root element" referring to? <html>? <body>?

Upvotes: 6

Views: 4873

Answers (2)

Sachin Kanungo
Sachin Kanungo

Reputation: 1064

All bodies of web with html standards start with <html>.This is why the root element is html tag. Even if you remove html tag from a html file and open it using browser, you can check the code by inspect element feature that browsers added html tags for you.

Upvotes: -1

Quentin
Quentin

Reputation: 943590

See the HTML specification.

For an HTML document, the root element is <html>.

See also the XML specification:

There is exactly one element, called the root, or document element, no part of which appears in the content of any other element.] For all other elements, if the start-tag is in the content of another element, the end-tag is in the content of the same element.

Upvotes: 10

Related Questions