28
CHAPTER 2. HTML
There are 90 different standard tag names, but we will only discuss the most
common of these.
Thus a web page consists of an html element that contains a head and body
element. The head element in turn contains a title element.
For example, the following text defines a simple Hello World webpage
My first web page
Hello World
If you put this in a file called first.html and then view the webpage with
your browser (using the Open... menu item). You will see a simple web page
consisting only of the words Hello World whose title bar contains the phrase
My first web page. If you bookmark this page, then the title My first web
page is what will appear in the bookmark.
Exercise 1 Creating your first web page. Use your favorite editor to create
a file containing the Hello World web page shown above. Store your file as
text with the name first.html on your disk. You can view your page by
starting up a browser (e.g. Netscape, Internet Explorer, Amaya, Opera, etc.)
and selecting Open File from the File menu. Select the first.html file that
you just created and you should see a simple page with the words Hello World
in black on a white or gray background. Beware: this simple exercise has many
pitfalls and it may take you a while to complete it. This is the kind of task
that is best done with someone helping you in person as the details vary from
computer to computer. Some of the problems that may arise are:
Some operating systems hide the extensions (.html, .txt, .jpg, .mov) that
specify what type of data is in the file. These operating systems also will
automatically add extensions (e.g. .txt) to files. So you may think you
have a file named first.html when it is actually called first.html.txt
Ouch!
You may have difficulty saving the file as text. Many word processors
store the document you create with a lot of extra information besides the
characters that you have typed. For example, they might store the font you
have used and the margins and tab setting, etc. The first.html file needs
to be stored in a simpler format which contains only the characters you
typed. This is called text format and is usually listed as a choice on the
save as window.