Webpage Workshop: Home » HTML language reference » Document title

Document title

This element is used to specify a title for the document. It can only appear in the head section of the document, and only once. To be a valid document, you must include a title element.

<title
    dir="ltr | rtl"
    lang="language code"
>
</title>

Key:
‡ = Required attribute
** = Transitional only

Explanation of attributes

dir: used to set the direction of the text in combination with the language set in the lang attribute. The available values are "ltr" (left to right) and "rtl" (right to left), with the default value being "ltr".

lang: used to indicate the language being used in the text contained within the element. The value of this attribute takes on the form of the ISO standard lanuage abbreviations found in RFC 3066. A list of these codes can be found on the ISO language codes page.

Event handlers

No event handlers are defined for this element.

Basic example

<title>How to use title elements</title>

The above code would set the title of the document to the text contained between the two tags.

Compatibility

Description: Support of document title and attributes in various browsers
Test Internet Explorer 6+ Netscape 4 Mozilla and Netscape 6+ Opera 6+ MSN TV (WebTV) Konqeuror 3.0+
Basic element support  Yes  Yes  Yes  Yes  Yes 
Attribute: dir  Yes  No  No  No  No  No 
Attribute: lang  Yes  No  No  No  No  No 

Key:
The browser icons are explained in the below list:
Internet Explorer 6+ = Microsoft Internet Explorer 6+
Netscape 4 = Netscape Communicator 4
Mozilla and Netscape 6+ = Mozilla and Netscape Navigator 6+
Opera 7+ = Opera 7+
MSN TV (WebTV) = MSN TV (aka. WebTV)
Konqeuror 3.0+ = Konqueror 3.0+