简体   繁体   English

rem的“根元素”是什么?

[英]What is the “root element” for rem?

W3 says : W3

Equal to the computed value of font-size on the root element. 等于根元素上font-size的计算值。 When specified on the font-size property of the root element, the rem units refer to the property's initial value. 当在根元素的font-size属性上指定时,rem单位引用属性的初始值。

What is this "root element" referring to? 这个“根元素”指的是什么? <html> ? <html> <body> ? <body>

See the HTML specification . 请参阅HTML规范

For an HTML document, the root element is <html> . 对于HTML文档,根元素是<html>

See also the XML specification : 另请参阅XML规范

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. 只有一个元素,称为根或文档元素,其中任何部分都不会出现在任何其他元素的内容中。]对于所有其他元素,如果start-tag在另一个元素的内容中,则为end-tag是在同一元素的内容中。

All bodies of web with html standards start with <html> .This is why the root element is html tag. 所有带有html标准的web主体都以<html>开头。这就是为什么根元素是html标签。 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. 即使您从html文件中删除html标记并使用浏览器打开它,您也可以通过inspect element功能检查代码,浏览器为您添加了html标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 CSS 中使用根元素和 rem 进行字体缩放 - font-scaling with root element and rem in CSS 从根html元素继承rem单元中基于长度的css属性 - Inheritance of length based css properties in rem unit from root html element 什么是 css / html `root` 元素? - What is the css / html `root` element? 同时具有多个值(px和rem)的CSS元素 - CSS element with multiple values (px & rem) at the same time 是什么<cbn-root> html元件? 以及如何通过 Java 解析它?</cbn-root> - What is the <cbn-root> html element? And how to parser it by Java? 使用rem声明的行距的参考属性是什么? - What is the reference property for a heading margin declared using rem? Material-UI 文档中的根元素是什么意思? - What is meant by root element in Material-UI documentation? 什么 html 元素用于反应根 dom 节点? - What html element to use for react root dom node? 是什么原因导致“错误:$ compile:tplrt无效的模板根目录”而模板只有一个根元素 - What is causing “Error: $compile:tplrt Invalid Template Root” while the template have only one root element 为什么 transform: translateY(-10rem) 不移动子图像元素,即在其父元素内? - Why isn't transform: translateY(-10rem) moving the child image element, that is within its parent element?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM