There are a handful of HTML tags which are a required part of every HTML page. This section will outline these required tags, their placement, and their usage.
The first tag is HTML. This tag surrounds ALL content on the page, both visible and invisible. The HTML tag tells the web browser that all content displayed between its opening and closing tags should be interpreted as HTML. Everything on an HTML page must lie between the opening and closing HTML tag (with one or two specific exceptions).
There are two additional tags which MUST be a part of every HTML page: HEAD and BODY. They are inserted between the opening and closing HTML tags, as follows:
<html> <head> </head> <body> </body> </html>
The HEAD of an HTML page contains mostly invisible, meta, or scripting information. The BODY of an HTML page contains ALL visible content; this includes all text, pictures, headings, lists, animations, sound files, and other multimedia elements. The HEAD contains the brains, so to speak, of the HTML page, while the BODY contains everything else.
In addition to the aforementioned tags, every HTML page must have a TITLE tag within the HEAD. This TITLE is displayed in the drag-region of the web browser window once the HTML page is loaded. The TITLE of an HTML page is probably the single most important piece of code in HTML as far as the outside world is concerned; this is because of the manner in which search engines (such as AltaVista or Lycos) use the words in the TITLE as keywords for categorization of your web page in their databases (we'll talk about search engines and TITLEs in a later module). Remember: every page MUST have a TITLE, and that TITLE MUST go in the HEAD!
<html> <head> <title>Michael's Doughnut Shoppe</title> </head> <body> </body> </html>
For much of this class, the only thing you'll ever see in the HEAD is the TITLE. The tags and scripts which pertain to the HEAD are intermediate and advanced topics, some of which we'll be covering in later modules of this class. In the meantime, the rest of the HTML that you'll be learning will go into the BODY, and ONLY into the BODY!
<html> <head> <title>Michael's Doughnut Shoppe<title> </head> <body> <p>Here is a paragraph of text.</p> <p>Here is another paragraph of text, with a <b>bold</b> word in it.</p> </body> </html>
View the above example.
If you can see something on an HTML page within the viewable area of a web browser window, that something MUST lie within the opening and closing BODY tags! There are NO exceptions! If, for some reason, you can NOT get your HTML to display properly when it's placed within the BODY tag, you have undoubtedly made some small syntax error in the code. I emphasize this, because students are always telling me that they couldn't get their code to display properly unless they put some visible thing or other into the HEAD of their HTML page; without exception, they had made a small syntax error in their HTML code which they had overlooked. NO VISIBLE CONTENT may be placed in the HEAD of an HTML page! If it's visible, it goes into the BODY!
Copyright © 2001 Michael Masumoto. All Rights Reserved.