Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css classes for html root element?

i found this code via Google Developer Tools:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class=" js canvas canvastext geolocation crosswindowmessaging websqldatabase no-indexeddb hashchange historymanagement draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms no-csstransforms3d csstransitions  video audio localstorage sessionstorage webworkers applicationcache svg smil svgclippaths no-opera no-mozilla webkit   fontface">
    </html>

and this code via html source code:

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> </html>

obviously these classes get generated with Javascript. But Why? Why so many css classes for html root element?

like image 978
DrStrangeLove Avatar asked May 25 '11 17:05

DrStrangeLove


People also ask

Can I use root in CSS?

Since CSS is also designed for SVG and XML you can actually use :root and it will just correspond to a different element. For example, in SVG the highest-level parent is the svg tag. Similar to HTML, the :root and svg tags select the same element, however the :root selector will have higher specificity.

What is root in HTML and CSS?

The :root CSS pseudo-class matches the root element of a tree representing the document. In HTML, :root represents the <html> element and is identical to the selector html , except that its specificity is higher.

What is the root of an HTML element?

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. None.


1 Answers

These get generated by Modernizr, as a means to identify what features are available to a user's browser.

like image 71
newtron Avatar answered Oct 11 '22 13:10

newtron