Metadata Elements
The metadata elements are used to set the presentation content of a document. This elements can also be used to set a relationship of a document with other documents. Metadata elements are as follows:
The HEAD element:
- The HEAD element contains the general information about the HTML document, such as title, keywords for search engines and a base address for URLs.
The TITLE element:
- The TITLE element contains the title of HTML document, which appears in the title bar of the Web browser.
- This element is used by search engines to select the document and display it in the search result.
The BASE element:
- The BASE element is used to specify a default URL and target for all the links in an HTML document.
- User can set a base URL for all the links once at the top of the document by using the BASE element.
- This element appears within the HEAD element of the document and should be used as the first element in the HEAD element. This enables the other elements in the head section to use the information of the BASE element.
The LINK element:
- The LINK element is used to link HTML document with others documents and defines the relationship between two different documents.
- The LINK element contains the 'href' attribute to specify the destination URL of a link. The href attribute is required attribute that must have a valid URL. If this attribute is not specified, then the LINK element does not define a link.
- The LINK element also contains the 'rel' attribute that defines the relationship of the linked documents. This attribute is also a required attribute and must have a valid value.
The META element:
- The META element is used to provide information about HTML document, such as page description and keywords.
- This element appears inside the HEAD element and has attributes like charset, content, http-equiv, name and scheme etc. from which only 'content' is a required attribute.
The COMMAND element:
- The COMMAND element is a new element introduced in HTML 5 and is used to execute a command when an event is fired by a form control, such as radio button or checkbox.
- The COMMAND element is used with the context menu or toolbar
Example:
<MENU label=”Games”>
<COMMAND type=”radio” radiogroup=”games” label=”cricket”>
<COMMAND type=”radio” radiogroup=”games” label=”football”>
</MENU>
The STYLE element:
- The STYLE element is used to declare the style sheets within the HTML document which specifies the how the HTML elements are rendered in a browser.
- The STYLE element has three attributes such as type, media and scoped.
- The STYLE element generally placed inside the HEAD element, but if scoped attribute is used then STYLE element can be placed in the BODY element of the document.
- Example:
<HEAD><STYLE type=”text/filename.css”>CSS CODE</STYLE></HEAD>
The SCRIPT element:
- The SCRIPT element is used to declare a script like JavaScript, within HTML document.
- This element either contains scripting statements or points to an external script file using 'src' attribute.
- The SCRIPT element generally used for validating Web forms and manipulating the content and images present on these forms.
- The SCRIPT element has five attributes, such as async, type, charset, defer and src.
The NONSCRIPT element:
- The NONSCRIPT element is used to display the alternate content on the Web browser that either does not support JavaScript or JavaScript disabled.
- If the JavaScript is enabled or supported by the Web browser then the NONSCRIPT element is not considered.
Example:
<SCRIPT type=”text/javascript”>
Document.write(“Hello World”);
</SCRIPT>
<NONSCRIPT>
JavaScript is disabled or not supported on browser.
</NONSCRIPT>