Page 33 - DCAP202_Fundamentals of Web Programming
P. 33
Fundamentals of Web Programming
Notes 3.1.1 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.
Notes 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.
The “body” comes after the head structure. Between the body tags, you find all of the stuff that
gets displayed in the browser window. All of the text, the graphics, and links, and so on - these
things occur between the body tags.
The strict variant of HTML 4.01 requires that any content inside the body is within a further set
of tags (if you use the transitional variant of HTML 4.01, this is not necessary). For text, you can
use “p” (the paragraph tag). A complete page would then look like this as shown in example:
Example: Writing a paragraph in HTML
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/ukt.dtd”>
<html>
26 LOVELY PROFESSIONAL UNIVERSITY