什么是 css/html `root` 元素? [英] What is the css / html `root` element?

查看:20
本文介绍了什么是 css/html `root` 元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近刚刚开始使用 NetBeans IDE (6.9.1),并使用它向我的网站中添加样式表.

I have just recently started using NetBeans IDE (6.9.1) and have used it to add a stylesheet to my site-in-progress.

令我惊讶的是,自动添加了一个元素:

To my surprise, one element was automatically added:

root { 
    display: block;
}

环顾四周,我可以找到一些关于 :root 伪类的信息,但没有找到关于 root 元素本身的信息.

Looking around, I could find some information about the :root pseudo-class but nothing about the root element itself.

什么是 root 元素,它有什么用?

What is the root element and does it have any use?

推荐答案

HTML 中没有 称为 根元素.html 元素本身是根元素"(这是给作为文档中所有其他元素的祖先的元素的术语),但这将与 html { } 匹配.

There is no element called root in HTML. The html element itself is "the root element" (which is the term given to the element which is the ancestor of all the other elements in the document), but this would be matched by html { }.

但是,请参阅 :root 伪代码-类(带冒号).

However, see the :root pseudo-class (with a colon).

这篇关于什么是 css/html `root` 元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆