Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the css / html `root` element?

Tags:

html

css

netbeans

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; } 

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

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

like image 336
jeroen Avatar asked Oct 12 '10 16:10

jeroen


People also ask

What is the root element in HTML?

The <html> HTML element represents the root (top-level element) of an HTML document, so it is also referred to as the root element. All other elements must be descendants of this element.

Where is root in 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 { } . However, see the :root pseudo-class (with a colon).

Why is HTML The root element?

The <html> element is the root element of the HTML page. The <head> element contains the document's metadata (including elements such as meta, title, style, script). The <title> element describes the title of the document. The <body> element contains the visible page content.


1 Answers

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 { }.

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

like image 147
Quentin Avatar answered Sep 30 '22 20:09

Quentin