|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
XHTML Document Header Resource Table of Contents Important Information This XHTML header tags resource is a work in progress, perpetually expanding and evolving as new information is obtained, explored, and integrated. Hopefully, you will find it useful in some way. Even better, perhaps you will share any complimentary or critical information concerning the contents of this article. This article presents information as concisely as possible, and is intended as a general overview of XHTML header tags. More detailed header tag information is available elsewhere. In this article, each tag is presented along with a brief definition or explanation. Where two (or more) tag examples are provided, the first is a generalized version while others represent specific situations. It is important to note that, when writing XHTML code, all tags (e.g., meta, link, head) and their corresponding attributes (e.g., href, rel, content) must be expressed entirely in lowercase character. However, the values of tag attributes are entirely case-insensitive. Also, valid XHTML also requires all tag elements to be closed. Thus, remember to close elements such as link, base, and meta with a "space-slash-bracket" (" />"). XML Declaration (Prolog) The XML Declaration, or prolog, is used in conjuction with XHTML and is not required for HTML documents. As XML documents, pages structured via XHTML should begin with an XML declaration: <?xml version="1.0" encoding="windows-1250"?> Note: documents using UTF-8 character encoding (default) do not need to use this declaration. Omission of the XML declaration is useful to prevent Internet Explorer from switching to “quirks mode.” XHTML/HTML !DOCTYPE This tag, used in conjunction with http-equiv content-type, provides complete document content information, equipping modern browsing devices to correctly interpret document contents. Check out this article for a more complete collection of conforming, bare-bones document templates. HTML 4.01 !DOCTYPE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> XHTML 1.0 !DOCTYPE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The html tag The html tag encloses all subsequent tags. The html tag may include various attributes, including one declaring any XML Name Space (xmlns), and another declaring various other XML properties (xml:property="value"). Use this for HTML: <html></html> Use this for XHTML 1.0 and 1.1: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"></html> And use this for XHTML 2.0: <html xmlns="http://www.w3.org/2002/06/xhtml2" The head tag The head tag encloses much of the documents “meta” information, and may include the following tags: <code>, <base>, <link>, <meta>, <script>, <style>, <title>. There are several attributes that may be included in the head tag, as shown in the following examples: <head dir="ltr | rtl" id="unique alphanumeric identifier" lang="language code" profile="url"></head> The title tag The title tag is a crucial part of any web document. An effective title may help the search ranking of the document. We all know this one: <title>The Document Title< /title> base & item The base tag indicates a predefined target base for all relative links provided on the page (related tag: http-equiv window-target). Using the base tag ensures relative links reach their targets even if the structure of the site directory changes. Further, the base tag is a great way to save bandwidth and simplify code by writing long URLs, parameterized URLs, and other unsightly URLs only once and out of view. Perhaps the most underrated of all tags. Here are two examples; the first defines an external target while the second instructs all links to open in a new window: <base href="http://www.domain.com/index.html"/> [ Note: for more information on available target attribute values, check out our delightful article, The Friendliest Link Targets in the Neighborhood. ] The item tag defines specific objects referenced in the document: <item label="label" url="http://www.domain.com/"/></item> http-equiv http-equiv tags send the browser information involving the actual processing of the web document itself. http-equiv tags effectively function in the same way as HTTP headers sent directly by the server, and are responsible for specifying actions related to content caching, location redirection, and page refreshing. The term “http-equiv” indicates its equivalence with HTTP headers, which are frequently generated from HTML tags such as http-equiv. http-equiv window-target The http-equiv window-target tag indicates a predefined target base for all relative links provided on the page (related tag: base). Using the http-equiv window-target tag ensures relative links reach their targets even if the structure of the site directory changes. Further, the base tag is a great way to save bandwidth and simplify code by writing long URLs, parameterized URLs, and other unsightly URLs only once and out of view. Here are examples showing some popular instances of the http-equiv window-target tag: <meta http-equiv="window-target" content="../../relative/directory/"/> <meta http-equiv="window-target" content="_top"/> [ Note: for more information on available target attribute values, check out our delightful article, The Friendliest Link Targets in the Neighborhood. ] http-equiv content-style-type & content-script-type The http-equiv content-style-type & content-script-type tags indicate document style and script types, respectively, thereby permitting their omission from corresponding tags> For example, inclusion of the http-equiv content-style-type tag with a content value of text/css permits the document authors to omit this information when writing all subsequent < style> tags. <meta http-equiv="content-style-type" content="text/css"/> http-equiv content-type The content-type tag specifies the document content type and corresponding character set. Examples of character type include UTF-8, ISO-8859-1, ISO-2022-JP. This tag instructs Netscape Navigator to load the appropriate character set before displaying the document contents. This tag should always be used in conjuction with the DTD declaration within the !DOCTYPE statement. Providing both DTD and http-equiv content-type ensures correct character interpretation and display. <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> Here is a (partial) list of character sets (charsets) commonly used to encode XHTML documents: http-equiv content-language The http-equiv content-language tag specifies the language used in the document. All supported languages are RFC-1766 compliant. Some supported languages include: BG (Bulgarian), CS (Czech), DA (Danish), DE (German), EL (Greek), EN (English), EN-GB (English-Great Britain), EN-US (English-United States), ES (Spanish), ES-ES (Spanish-Spain), FI (Finnish), HR (Croatian), IT (Italian), FR (French), FR-CA (French-Quebec), FR-FR (French-France), IT (Italian), JA (Japanese), KO (Korean), NL (Dutch), NO (Norwegian), PL (Polish), PT (Portuguese), RU (Russian), SV (Swedish), ZH (Chinese). <meta http-equiv="content-language" content="EN"/> http-equiv pragma & cache-control The http-equiv pragma & cache-control tags are used together to control document caching and archiving. There are several methods of controlling how search engines and other clients crawl site content. If possible, use a robots.txt or htaccess file to accomplish caching directives. If it is not possible or preferable to use either of these files, the http-equiv pragma & cache-control tags are preferred over the popular meta robots tag, as their caching influence is more universally affectual. Possible content values include: public (content may be cached in public shared caches), private (content may only be cached in private cache), no-cache (content may not be cached), and no-store (content may be cached but not archived). <meta http-equiv="pragma" content="no-cache"/> http-equiv reply-to The http-equiv reply-to tag specifies contact information (related tag: meta reply-to): <meta http-equiv="reply-to" content="spam@spamcity.com"/> http-equiv refresh The http-equiv refresh tag is used to redirect or refresh the document, but is no longer recommended because of the exclusion rules of several major search engines. The preferable method for URL redirection is via htaccess and mod_rewrite4. The content value, “x” in our example, determines the amount of time in seconds before which the browser will be redirected or refreshed according to the specified URL (related tag: meta refresh). <meta http-equiv="refresh" content="x; url=http://www.domain.com/doc.html"/> http-equiv set-cookie The http-equiv set-cookie tag creates a persistent cookie according to specified attributes, which include: value (the name of the cookie), n (the value of the cookie), date (the date/time of expiry), and url (the associated cookie path, if any). When the expiry date value is null, the cookie is deleted after the current session. The expiry date should be expressed in RFC850 format. <meta http-equiv="Set-Cookie" content="value=n; expires=date; path=url"/> http-equiv expires The http-equiv expires tag specifies an expiry date/time for the document. All date/time stamps must be generated in Greenwich Mean Time5 (GMT) and in RFC 1123 format. For more information on GMT formatting, check out our article, Greenwich Mean Time (GMT) Formats. Related tag: meta expires. <meta http-equiv="expires" content="Mon, 04 Jul 2050 07:07:07 GMT" /> http-equiv page-enter The http-equiv page-enter tag instructs compatible browsers to apply the specified transition to your page upon entering. Set the Duration value to the amount of time over which the transition should occur. Set the Transition value to the corresponding transitional effect (see below). Note that this trick will not work with frames. <meta http-equiv="page-enter" content="RevealTrans(Duration=second;Transition=n)"/> http-equiv page-exit The http-equiv page-exit tag instructs compatible browsers to apply the specified transition to your page upon page exit. Set the Duration value to the amount of time over which the transition should occur. Set the Transition value to the corresponding transitional effect (see below). Note that this trick will not work with frames. <meta http-equiv="page-exit" content="RevealTrans(Duration=second;Transition=n)"/> Here is a list of transition numbers and their corresponding transitional effects: miscellaneous http-equiv attributes <meta http-equiv="imagetoolbar" content="no" /> <meta http-equiv="MsThemeCompatible" content="no" /> link tags6 link next The link next tag specifies the URL of the next document (in a series of documents) that the agent/browser should load: <link rel="next" href="[Next URL in series]"/> link prev The link prev tag specifies the URL of the previous document in a series of documents: <link rel="prev" href="[Previous URL in series]"/> link prefetch The link prefetch tag specifies a URL which should preload: <link rel="prefetch" href="[URL to preload]"/> link stylesheet The link stylesheet tag is used to associate an external .CSS file with the document. When using the link stylesheet tag it is necessary to include both type="text/css" and media="value", where “value” is set to either “print”, “screen”, or “all”: <link rel="stylesheet" href="/css/print.css" type="text/css" media="print"/> link shortcut icon The link shortcut icon tag is used to associate a favicon.ico file to the document. In addition the link shortcut icon tag, the link icon tag also links a site to its associated favicon. Often, documents employ both of the following links tags (with identical directory paths) simultaneously: <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> link alternate The link alternate tag may be used for establishing any number of a variety of link types. This tag is frequently associated with syndicated content, their inclusion subsequently enabling modern browsers to “autodiscover” any feeds that may be offered. For WordPress users, there is now a plugin that automatically produces a user-specified set of feed links 2. For this tag, the type attribute defines the feed format, while the title attribute specifies the title given to the feed. Here are several examples of the link alternate tag providing feed links: <link rel="alternate" type="application/rss+xml" title="RSS 2.0 Feed" href="http://www.domain.com/RSS"/> link pingback The link pingback tag enables pingbacks by associating required function(s) via the hypertext reference attribute (href): <link rel="pingback" href="http://www.domain.com/xmlrpc.php"/> link archives The link archives tag is used to associate a set of archive links to specified documents: <link rel="archives" title="Archive Title" href="http://www.domain.com/archive/2002"/> link bookmark The bookmark tag specifies a “key entry point within an extended document.” For example, the following bookmark links employ title attributes to specify associated names for each of the bookmarks. Each web document may include multiple bookmark links. <link rel="bookmark" type="text/html" href="http://domain.tld/current-doc.php#bookmark-01" title="Title of First Bookmark"/> a few more.. Here are a few more that should be relatively (ha ha) self-explanatory: <link rel="contents" href="http://domain.tld/main/" title="Main Contents"/> Beyond the link types defined in this article, authors may create customized link types by defining them in an associated profile. For more information, refer to the profile attribute in the head element of this document (view source code). |
|||||||||||||||||||||||||||||||||||||||||||||||||
| optimisation - more - freelink - paidlink - contactUS | ||||||||||||||||||||||||||||||||||||||||||||||||||