Structure

HTML Head

Structuring the HTML Head

HTML head contains metadata like <title> and <meta>, guiding browsers.

Introduction to the HTML Head

The <head> element in an HTML document is crucial for providing metadata about the document. It does not contain content that is displayed to users but rather contains information used by browsers and search engines to render the page correctly.

Basic Structure of the HTML Head

The <head> section is placed within the <html> tag and above the <body> section. It typically includes elements such as <title>, <meta>, <link>, <style>, and <script>.

The &lt;title&gt; Element

The <title> element defines the title of the document, shown in the browser's title bar or tab. It is an essential element for SEO as it tells search engines what the page is about.

The &lt;meta&gt; Element

The <meta> element provides metadata about the HTML document. Metadata is data (information) about data. Here are some common uses:

  • Charset: Specifies the character encoding for the HTML document (<meta charset="UTF-8">).
  • Viewport: Controls the page's dimensions and scaling on different devices (<meta name="viewport" content="width=device-width, initial-scale=1.0">).
  • Description: Provides a brief summary of the page's content (<meta name="description" content="Free Web tutorials">).
  • Keywords: Lists important keywords relevant to the content (<meta name="keywords" content="HTML, CSS, JavaScript">).
  • Author: Indicates the author of the document (<meta name="author" content="John Doe">).

Linking Stylesheets with &lt;link&gt;

The <link> element is used to link external resources to the HTML document. Most commonly, it links to stylesheets that define the appearance of the page. The rel attribute specifies the relationship between the current document and the linked resource.

Including Scripts with &lt;script&gt;

The <script> element is used to embed or reference executable scripts. Commonly used for JavaScript, it can either include inline scripts or link to external script files.

Previous
Charsets
Next
Body