head Creating a Web Page s Head

<head> Creating a Web Page's Head

The <head> element contains the head of an XHTML document, which should contain at least a <title> element. The <head> element is supported in XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, and XHTML 1.1. Here are the attributes of this element:

  • dir Sets the direction of text that doesn't have an inherent direction in which you should read it, called directionally neutral text. You can set this attribute to LTR , for left-to-right text, or RTL , for right-to-left text. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • lang Specifies the base language used in the element. This applies only when the document is interpreted as HTML. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • profile Specifies the location of one or more whitespace-separated metadata profile URIs. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

  • xml:lang Specifies the base language for the element when the document is interpreted as an XML document. (XHTML 1.0 Strict, XHTML 1.0 Transitional, XHTML 1.0 Frameset, XHTML 1.1.)

Each XHTML document should have a <head> element, like the one in this example:

 <?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> 

The head of an XHTML document holds information that isn't directly displayed in the document itself, such as a title for the document (which usually appears in the browser's title bar), keywords that search engines can pick up, the base address for URIs, and so on. The head of every XHTML document is supposed to contain a <title> element, which holds the title of the document.

This element also supports the usual attributes, such as lang and xml:lang , as well as one attribute that is specific to <head> elements: profile . The profile attribute can hold a whitespace-separated list of URIs that hold information about the document, such as a description of the document, the author's name , copyright information, and so forth. (None of the major browsers implements this attribute yet.)

Here are the elements that can appear in the head:

  • <base> Specifies the base URI for the document

  • <isindex> Supports rudimentary input control

  • <link> Specifies the relationship between the document and an external object

  • <meta> Contains information about the document

  • <noscript> Contains text that appears only if the browser does not support the < script> tag

  • <object> Embeds an object

  • <script> Contains programming scripts, such as JavaScript code

  • <style> Contains style information used for rendering elements

  • <title> Contains the document's title, which appears in the browser

As mentioned, each <head> element should contain exactly one <title> element.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net