HTML HTML intro.
  1. HTML intro
  2. Web pages and you
HTML basics
  1. HTML getting started
  2. HTML basics
  3. HTML document
HTML text
  1. HTML text formatting 1
  2. HTML text formatting 2
  3. HTML text formatting 3
  4. HTML fonts
  5. HTML entities
HTML links
  1. HTML links
  2. HTML email links
HTML images
  1. HTML images
  2. HTML image maps
HTML forms
  1. HTML forms
  2. HTML form labels
  3. HTML fieldset/legend
HTML tables
  1. HTML tables
  2. HTML tables concepts
HTML frames
  1. HTML frames
HTML backgrounds/color
  1. HTML backgrounds
  2. HTML colors
  3. HTML color shades
  4. HTML color usage
HTML style/layout
  1. HTML stylesheets
  2. HTML div/span
HTML media
  1. HTML audio
  2. HTML video
  3. HTML objects
  4. HTML download media
HTML declaratives
  1. HTML head section
  2. HTML meta tags
  3. HTML scripts
  4. HTML declarations
  5. HTML document types
Practical HTML
  1. HTML tag rules
  2. HTML things to avoid
  3. URL formatting
  4. URL encoding/decoding
  5. HTML use/access
  6. HTML publish work
HTML extras
  1. HTML marquees
HTML wrap-up
  1. HTML history
  2. HTML summary

HTML head section

As with everything else, there is much more to a webpage than what you just see. Besides what you see on a webpage, also important is what is going on 'under the hood'.

This tutorial focuses on:

The <head> tag

The <head> tag is what actually begins the head section of an HTML document. The head section of an HTML document contains several tags that specify important information about the webpage such as title, keywords and descriptions (for search engines), location of stylesheets, scripts, and more.

Example:
<html> <head> <!-- tags that specify important information about the page here --> </head> <body> <!-- page content here --> </body> </html>

Tags inside the head section

There are several tags that go inside the head section of an HTML document.

The <base> tag

The <base> tag acts as a reference point for all the links on a page. This reference point is specified with the <base> tag's href attribute.

Example:
<base href="http://www.landofcode.com />

NOTE: The <base> tag does not have a closing tag.

Read more about the <base> tag in our HTML universal declarations page.

The <link> tag

The <link> tag defines a relationship between two douments. It is used to define the relationship between the document where it is located and another document.

A common use of the <link> tag is to call an external stylesheet:

<link rel="stylesheet" type="text/css" href="/css/style.css" />

NOTE: The <link> tag does not have a closing tag.

Read more about the <link> tag and stylesheets in our HTML stylesheets page.

The <meta> tag

The <meta> tag is one of the most important tags in HTML. The <meta> tag is used to describe the page in some way as well as other things such as refreshing a page automatically after a certain amount of time, and preventing webpages from being displayed in another websites frames page. Some of the things that can be described using the <meta> tag include the pages author, the software used to create the page, and a description of the content on the page.

Example:
<meta name="keywords" content="computers, electronics, cameras" />

NOTE: The <meta> tag does not have a closing tag.

Read more about the <meta> tag at our HTML meta tags page.

The <script> tag

The <script> tag is used to place scripts on a webpage. When using the <script> tag, you have to use its type attribute to specify the language the script is written in.

Example:
<script type="text/javascript"> document.write("This is a Javascript script."); </script>

Read more about the <script> tag and using scripts at our at our HTML scripts page.

The <style> tag

The <style> tag is used to declare an internal stylesheet.

The <style> tag specifies the content type of a stylesheet with its type attribute which should be set to "text/css".

Example:
<style type="text/css"> h1 { color: #000080; } </style>

Read more about using the <style> tag and stylesheets at our HTML stylesheets page.

The <title> tag

The <title> tag declares the title for a webpage. The title of a webpage can be seen in the top left corner of the web browser. If you look at the top left corner of your web browser window right now, you will see the title HTML head section, as that is the title of this page.

Example:
<title>Introduction to HTML</title>

Putting innapropriate tags in the head section

The above mentioned tags are the only tags that should go in the head section of an HTML document. If you try to put any other tags in the head section of an HTML document, most browsers will display their content, but this will be semantically incorrect and will result in a page that does not validate with a page validator. This is a bad practice and should be avoided.

© Copyright 2013-2014 Landofcode.com
Terms of use | Privacy policy | Copyright information