Page 42 - DCAP408_WEB_PROGRAMMING
P. 42
Web Programming
Notes If you want to use commands from previous versions of HTML, you can use the transitional
variant of HTML 4.01 instead:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
In older web pages, you may note that the DOCTYPE declaration is missing. This is because it
was not required in earlier versions of HTML.
!
Caution You can still write web pages without it and most browsers will display your
page correctly. However, in order to write a valid HTML page, it is required nowadays.
2.1.2 HTML Tag
After the DOCTYPE declaration come the “html” tags. These are the tags that tell a web browser
where the HTML part in your document begins and ends.
<html>
</html>
Inside the “html” container, we have the “head” and the “body” container:
<html>
<head>
</head>
<body>
</body>
</html>
The “body” contains the actual content of your web page.
The “head” contains all of the document’s header information like the web document’s title and
information about the document itself. This is an important point for search engines.
The container “title” is placed within the head structure. Between the title tags, you should have
the title of your document. This will appear at the top of the browser’s title bar, and also appears
in the history list. Finally, the contents of the title container go into your bookmark file, if you
create a bookmark to a page.
Also, the head contains meta information about the document, most importantly the character
encoding that is used.
The encoding “ISO-8859-1” is used for English, French, Spanish, German and other Western
European languages.
Here you see an example of a “head” container with a “title” element and a “meta” element
denoting the encoding:
<head>
<title>This is my very first HTML document</title>
<meta http-equiv=”content-type” content=”text/html;
charset=ISO-8859-1">
</head>
Again, you can just copy the “meta” element as you see it above into your document.
36 LOVELY PROFESSIONAL UNIVERSITY