<title> The Document's Title
As in HTML, the <title> element contains a title for the document, stored as simple text. Most browsers will read the document's title and display it in the title bar. The title of a document is also used by search engines. This element is supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1. Here are the attributes for this element:
You use the <title> element to specify the document's title to browsers and search engines; browsers usually display the title in the title bar. The W3C XHTML DTDs say, "Exactly one title is required per document." However, the W3C XHTML validator doesn't complain if you omit a title. Nonetheless, you should put a <title> element in every document.
We saw an example <title> element at the beginning of this chapter:
<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Welcome to my page </title> </head> <body> <h1> Welcome to XHTML! </h1> </body> </html>
No major browser will react badly if you don't give a document a title. However, XHTML documents should have one, according to the W3C.
We've completed the head section of XHTML documents; next comes the body.