HTML – HTML Element and Attributes Group

Element and Attributes

<HTML> Element

The <html> element is the containing element for the whole HTML document.

After the declaration of the DOCTYPE, each and every HTML document should have the <html> element opening and closing </html> tag.  

If you are writing strict XHTML 1.0 the opening must also include a namespace identifier. 

The concept of using namespaces may seem a little odd at first. Now it is depreciated. 

The <html> element can also carry the following attributes; we will talk more about them in later in chapters.

  • id
  • dir
  • lang
  • XML:lang

In earlier versions of HTML, a version attribute could be used to indicate which version of HTML document is written in, although it is usually depreciated or left off.

HTML documents should use the DOCTYPE declaration along with the xmlns attribute to indicate which version of HTML they use.

HTML Attributes Group 

As you have seen, most of the time attributes are used to do some changes with the HTML element.

Attribute live on the opening tag of an element and provide the extra information about the element that carries them.

All attributes consist of the name and value; the name contains the property of the element and the value is a value for that property. 

For example,

the xml:lang attribute describes the language used within that element; the value may be the EN-US- that indicates the U.S English

Three Type of Attributes, 

  1. Core Attributes 
  2. Internationalization Attributes 
  3. UI Events

Core attributes– The class, id, and title are the core attributes in HTML.

Internationalization Attributes– The dir, lang, and XML:lang is the internationalization attributes in HTML

UI Events-The attributes associated with events such as click, double-click, on mouse down, and etc are the UI events in HTML [We will talk about this event in JavaScript Tutorial]

Remember: Together, the core attributes and the internationalization attribute are known as universal attributes.