Certified HTML Designer Learning Resources head element

Learning Resources
 

The Head Element and Related Elements


HEAD

The <head> element contains metadata and other information about the document that is not directly visible in the content of the webpage. It can include the document's title, links to stylesheets, scripts, and other meta-information. While the <head> element itself does not have attributes and its start and end tags can often be inferred by the parser, it's still crucial to include it for proper document structure. The <title> element is required within the <head> and provides a title for the document that is displayed in the browser's title bar or tab.


Elements Within the HEAD

BASE The <base> element specifies a base URL for all relative URLs in the document. This is useful when a document contains links or resources with relative paths. By setting a base URL, you ensure that all relative paths are resolved correctly relative to this base URL.


<base href="https://acme.com/docs/">


In this example, a relative URL such as images/me.gif will resolve to https://acme.com/docs/images/me.gif.


ISINDEX

The <isindex> element was used to indicate that the document could be searched using a query. This element has been deprecated in favor of using more advanced search mechanisms, so it is rarely used today.


Example usage:

<isindex prompt="Search this document:">


Note: Modern websites typically use search engines or JavaScript-based solutions instead of <isindex>.


LINK

The <link> element is used to define relationships between the current document and other documents or resources. It is commonly used to link to stylesheets or to define document-specific toolbars.


Example to link a stylesheet:

<link rel="stylesheet" href="styles.css">


Example of document-specific toolbar links:

<link rel="home" href="index.html">

<link rel="next" href="page2.html">


Here are some common rel attribute values for toolbars:


REL=Home – Link to the home page.

REL=ToC – Link to the table of contents.

REL=Index – Link to an index for the document.

REL=Glossary – Link to a glossary of terms.

REL=Copyright – Link to the copyright statement.

REL=Up – Link to the parent document in a hierarchy.

REL=Next – Link to the next document.

REL=Previous – Link to the previous document.

REL=Help – Link to a help document.

REL=Bookmark – Direct links to key points in the document.


META The <meta> element provides metadata about the document, such as author information, description, keywords, and HTTP headers.


Example for setting document metadata:

<meta name="author" content="John Doe">

<meta name="description" content="An example document">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


Common attributes:

NAME – Specifies the name of the metadata property.

CONTENT – Provides the value for the metadata property.

HTTP-EQUIV – Represents HTTP headers.


NEXTID

The <nextid> element was used in early HTML to generate unique identifiers for anchors. It has largely fallen out of use and is not supported in modern HTML standards.


Example:

<nextid id="z123">

Note: The use of <nextid> is deprecated.


RANGE

The <range> element was used to mark ranges in a document for purposes such as highlighting or annotation. It allowed for defining ranges between two points identified by SGML identifiers.


Example:

<range id="section1" class="highlight" from="startpoint" until="endpoint">


Common attributes:

ID – Identifies the range.

CLASS – Provides a class for styling.

FROM – Start of the range.

UNTIL – End of the range.


STYLE

The <style> element contains CSS styles that are applied directly to the document. Styles defined here override external stylesheets.


Example:

<style>

  body {

    background-color: #f0f0f0;

  }

  p {

    color: #333;

  }

</style>


TITLE

The <title> element defines the title of the document. It is displayed in the browser's title bar or tab and is used by search engines and bookmarking tools.

Example:

<title>Example Document Title</title>

Note: The <title> element must appear exactly once within the <head> and should succinctly describe the document's content.


Summary

The <head> element and its contained elements play a crucial role in providing metadata, linking resources, and defining document properties. While some elements like <isindex> and <nextid> are deprecated, others like <meta>, <link>, and <style> continue to be essential for modern web development. Understanding these elements will help you structure your HTML documents effectively and ensure they are well-represented in browsers and other tools.

 For Support