Html – Class attribute in tag

html

Is class a legal attribute of the HTML element?

<html class="...">

My Oracle ADF application does this — why?

Best Answer

It is not valid in HTML 4:

<!ENTITY % html.content "HEAD, BODY">

<!ELEMENT HTML O O (%html.content;)    -- document root element -->
<!ATTLIST HTML
  %i18n;                               -- lang, dir --
  >

It is not valid in XHTML 1.0:

<!ELEMENT html (head, body)>
<!ATTLIST html
  %i18n;
  id          ID             #IMPLIED
  xmlns       %URI;          #FIXED 'http://www.w3.org/1999/xhtml'
  >

It is valid in HTML 5:

The following attributes are common to and may be specified on all HTML elements (even those not defined in this specification):

  • ...
  • class
  • ...

My Oracle ADF application does this - wounder why

Presumably to apply style or JS from a shared external file to specific pages.