January 09, 2012

A Look At Web Programming: Part 5


The first tag in our Hello World example is the DOCTYPE tag, which stands for the Document Type Declaration.  The DOCTYPE declaration does a couple of things, but the most important is that it tells the browser how to render the page.  In this case, we used <!DOCTYPE html> since we will be using HTML 5 in later sections.  Other DOCTYPES include:

HTML 4.01 Strict:


XHTML 1.0 Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

XHTML 1.1 Basic:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"

Just to name a few.  For even more DOCTYPEs, a simple web search will yield most of the supported Document Type Declarations.

The HEAD Tag

The <head> tag is a container for elements that won't display on web pages, but contain useful information.  The <head> tag is only valid within the HTML Element ("<html>").
Within the HEAD element, we can specify the title of the web page.  In our Hello World example, we set the title to "Hello World!" using the line:

<title>Hello World!</title>

The TITLE element is only valid within the HEAD element.  There is other valuable information we can put inside the HEAD tag, which we will learn in later sections.


Post a Comment