Structure of a Web Page

A web page has 4 key parts, these are;

doctype

The doctype is the first item in a html document. The doctype declares the markup language and version used. This allows the web browser to display the content as outlined in the Document Type Declaration - DTD. If no doctype is provied, the web browser will render the html page in "quirks mode".

html

Imediatly after the doctype declaration comes the html element. This is the outter most element and will contain all html code within it. This element is also known as the root element.

head

The head element is the next element to appear. This element will contain information about possible style sheets, javascript and meta data. Information contained within this element is not visible to users unless they choose to view the source code.

body

The body element will contain the content of the html document such as text, tables, lists, links and images.

Example Web Page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<link rel="stylesheet" type="text/css" href="style.css" media="screen, projection" />
	<title>Hello World!</title>
</head>
<body>
	<h1>Hello World!</h1>
</body>
</html>