views:

78

answers:

2

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?

+5  A: 

From here: http://www.quirksmode.org/css/root.html

The :root pseudo-element selects the root of all blocks in the page, ie. the Initial Containing Block. In HTML this is obviously the <html> element

Test stylesheet:

 :root {    
     background-color: #6374AB;
    padding: 50px; 
 } 

If the :root selector works the left and right column of the page are blue, and the white middle column is offset by 50 pixels.

David Stratton
Thanks, that´s what I found as well, but I was wondering about the `root` element that NetBeans inserted, not the pseudo-element.
jeroen
Since there is no such html tag, and it does not appear to be documented anywhere that I can find it, I'm going to guess that it's meant as sample code to show you how css is supposed to look for newbies. All I can tell you is that it'sdefinitely in the template, and you can edit the template yourself if you don't like it under "tools - templates" and then go to the "Web" folder. I wouldn't consider it a "bug" since it's obviously intentional. More like an "undocumented useless feature".
David Stratton
I guess you're right, it´s not really a bug; I´ve changed the template so I won´t be seeing it again.
jeroen
+2  A: 

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

David Dorward
So that means it´s some kind of bug in NetBeans?
jeroen