HTML Tutorial: How The Web Works, Part I: Introduction To HTML
HTML Tutorial: How The Web Works, Part I: Introduction To HTML
HTML Tutorial
(version 5.0)
This tutorial is designed to teach you some the basics of HyperText Markup Language (HTML),
with an emphasis on transforming a word-processing document into a simple Web page.
You can get the most recent version of this tutorial from the CAT website:
http://cat.xula.edu/tutorials/
Contents
This tutorial will guide you through the following steps:
1. Retrieving the necessary materials from the Web
2. Copying text from a word-processing document and pasting it into an HTML template
3. Marking block elements and validating your work
4. Marking inline elements and validating your work
5. Using Netscape Composer
6. Using Word's "Save as HTML" feature.
7. Uploading your files to the Web server
Prerequisites
This tutorial assumes a level of competency with basic computing tasks and concepts. You should
understand the following terms:
Files
Folders
File hierarchy
The desktop
The Finder (Mac only)
Conventions
Actions that you need to perform are bulleted, like this:
Open the file.
Menu commands look like this: File > Open. This means choose the Open option from the File
menu. Sometimes, for the sake of brevity, common menu items may be referred to simply as
Save or Open. The same style is used for other user interface elements, such as key you're
supposed to press and buttons you're supposed to click, i.e. "Click the OK button."
HTML code and URLs look like this:
<BODY BGCOLOR="white">
Names of files and folders, as well as text that you are supposed to type, are rendered in italics.
1
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
2
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
1. Retrieve Materials
First you must create a folder to hold your files.
Create a new folder on the desktop and name it tutorial.
Windows users: You can do this quite simply by clicking on the desktop with your right
mouse button and choosing New > Folder from the pop-up menu. Then, without
pausing to draw breath, type the word tutorial. Press the Enter key and you're done.
Mac users: You can do this quite simply by clicking on the desktop while pressing the
Control key; choose New Folder from the pop-up menu. Then, without pausing to
think, type the word tutorial. Press the Return key and you're done.
Next, you must retrieve the necessary materials from the Web.
Start Netscape, and point the browser to this URL:
http://cat.xula.edu/tutorials/html/
Find the section of the page under the heading Tutorial Materials.
Follow the link to All_About_Mustard.doc which is a Microsoft Word Document.
Save this file in the tutorial folder you created earlier. (You'll be prompted by Netscape.)
Follow the link to template.txt which is a plain text file.
The contents of the file will be displayed in the browser window. It should look like this:
</BODY>
</HTML>
This should look familiar to you. You'll use this raw code as a template for your first Web page.
The best way to save this file to disk is simply to copy and paste:
Choose Edit > Select All to select all the text.
Choose Edit > Copy to copy the selected text.
Launch a text editor.
Windows users: Use Notepad. From the Windows Start menu, choose Run… and
enter notepad.
Mac users: Use SimpleText. This application can usually be found on the hard drive, in
the Applications folder.
In your text editor, select Edit > Paste. The text you copied from your browser should
appear in the window of the text editor.
Save this file. Name it template.txt and make sure that you are saving it in your tutorial
folder.
Close your text editor and return to Netscape.
You should now have a Word document and a plain text file in your tutorial folder — all the
materials you need to complete this tutorial.
3
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
4
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Mustard Links
§ Européenne de Condiments
http://www.moutarde.com/
A mustard company's website
§ Mustard Gas
http://www.spartacus.schoolnet.co.uk/FWWmustard.htm
A description of mustard gas
§ Mount Horeb Mustard Museum
http://www.mustardweb.com/
The world's largest collection of prepared mustards
</BODY>
</HTML>
5
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Now you need to save a copy of this file, without overwriting our original template. You also need
to designate the new copy as a hypertext file, rather than a plain text file.
Choose File > Save As…
Name the file mustard.html and click the Save button, making sure to save the file in
your tutorial folder.
Congratulations! You've just created a Web page. It's incomplete, to be sure, but take a moment
to see how it looks in your Web browser:
Return to Netscape.
Choose File > Open Page. (Mac users should choose File > Open > Page in Navigator.)
A dialog box should appear. Navigate to your tutorial folder. (Windows users will need
to click the Choose File button.)
Choose the mustard.html file, and click the Open button.
Your Web page should now be displayed in the browser. Note how all the text is run together. All
the extra whitespace and line breaks are ignored by the browser.
Here's what you've accomplished so far: by using the template file, you saved yourself the chore of
typing out the basic "shell" of the Web page. The template establishes the global structure of the
document, including version information and the HEAD and BODY.
You've pasted raw text into the BODY of the document. However, you have not yet marked up any
of the text, and so the text has no logical structure.
6
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Note: That's a number one (1) after the H, not a lowercase letter L !
Return to your text editor. The mustard.html file should still be open. (If not, you will
need to open it within your text editor.)
Mark all the headings. Remember that headings range from H1 (most important) to H6
(least important). You've already marked a first-level heading, so mark up some second-
and third-level ones.
Hint: There are three second-level headings and two third-level headings in the
document.
For example, the second heading should be marked to look like this:
7
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
<P>
It is reputed that at a festival in 1336 attended by the Duke of Burgundy
and his cousin King Philip the Fair, no less than 70 gallons of mustard were
eaten. Reports do not say how pickled the guests were.
</P>
<BLOCKQUOTE>
<P>
[The Kingdom of Heaven] is like a mustard seed. It is the smallest of all
seeds; but when it falls on tilled soil, it produces a great plant and
becomes a shelter for birds of the air.
</P>
</BLOCKQUOTE>
Mark the ordered list (the one that is numbered) with OL tags.
Hint: You are marking the whole list here, not the individual items in the list.
<OL>
1. Whisk together dry mustard, vinegar and beer.
2. Use a garlic press or large pair pliers to squeeze the juice from the
clove of garlic into the mixture.
3. Stir in sugar, salt and turmeric.
4. To make mustard smoother and less hot, add olive oil to taste.
</OL>
Mark the unordered list (the bulleted list of links) with UL tags.
<UL>
* Européenne de Condiments
http://www.moutarde.com/
A mustard company's website
* Mustard Gas
http://www.spartacus.schoolnet.co.uk/FWWmustard.htm
A description of mustard gas
* Mount Horeb Mustard Museum
http://www.mustardweb.com/
The world's largest collection of prepared mustards
</UL>
Mark the individual list items in both lists with LI tags. Don't forget to mark up both the
Preparation list and the Mustard Links list.
Hint: There are only three items (not nine) in the list of links.
<LI>
Européenne de Condiments
http://www.moutarde.com/
A mustard company's website
</LI>
Add a horizontal rule at the end of the page with the HR tag.
Hint: The tag still needs to be in the BODY of the document. Also, remember that this is
an empty content tag, so there is no closing tag.
8
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Add some information about how to contact the author of the page after the HR tag. Type
something like: This page is maintained by Bart Everson [[email protected]].
Substitute your own name and e-mail address for mine.
Mark the line you just typed with ADDRESS tags.
Every chunk of text should now be enclosed in one HTML tag or another.
Choose File > Save to save your work.
Return to Netscape and reload the page to check your work.
You should notice some problems. The ordered list may have duplicate numbers, and the list of
links may have a § or * symbol after each bullet. These are artifacts of the conversion from Word
to HTML. Also, the list of ingredients is still a jumbled mess. The list of links is also messy.
Fix these problems as follows:
Return to your text editor.
Delete the numbers in the ordered list. They don't need to be explicitly stated.
Delete the § or * symbols from the list of links. They are also redundant.
What about the list of ingredients? You could mark it as an unordered list, but then it would be
bulleted. Besides, you already have one unordered list on the page. Therefore you will mark this
as preformatted text.
Mark the list of ingredients with the PRE tag.
Choose File > Save to save your work.
Return to Netscape and reload the page to check your work.
The problems should be fixed, except for the list of links. You will fix that problem in section
below.
<BODY BGCOLOR="yellow">
9
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
http://validator.w3.org/
This is the W3C's HTML validation service. It allows you to enter a URL for any page that's on the
Web and check the validity of its HTML.
Since your Web page is not on the Web (yet), follow the "upload files" link toward the
bottom of the page.
This will take you to a page which allows you to check the validity of files from your hard drive.
Click the Browse button.
Navigate to your tutorial folder, select the mustard.html file, and click the Open button.
Click the Validate this document button.
If you're lucky, you'll get a "No errors found!" message. If not, examine the results to see if you
can pinpoint your mistake. Once you've corrected your errors, try to validate your document
again. Don't move on to the next section until you succeed.
10
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
11
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Remember, Navigator is a browser, with which you view Web pages. Composer is an authoring
application, with which you create Web pages.
12
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Next, you must recopy the raw text of the Word document.
Return to Microsoft Word.
Open the file named All_About_Mustard.doc, if it is not already open.
Funny thing about Composer — if you just paste the text in as you did before, it would interpret
each carriage return as a single line break. But Composer interprets double carriage returns as
indicative of paragraphs. So…
Before each full paragraph, insert an extra carriage return with the Enter key (Windows)
or the Return key (Mac).
Choose Edit > Select All to select all the text.
Choose Edit > Copy to copy the selected text.
Return to Composer.
Choose Edit > Paste to paste the copied text.
Choose File > Save and save your file as mustard_composer.html. Make sure to save it
in your tutorial folder.
As you save the page, Composer will prompt you for a page title. It's asking what you want to put
between the TITLE tags.
Mac users: If Composer does not prompt you, choose Format > Page Title.
Enter an appropriate title, such as " Sample Web Page Using Composer," then click OK.
13
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
o By default, Composer makes each line in the list a bulleted item. But you don't
want the URLs and descriptions to be separate items.
To correct this, click at the beginning of each URL.
Press your backspace (Windows) or delete (Mac) button until the URL
appears on the same line as the site name.
Insert a line break by choosing Insert > New Line Break or by pressing
Shift + Enter (Windows) or Shift + Return (Mac).
Designate the ordered list (the one that is numbered) by choosing Format > List >
Numbered. Or you can just click the numbered list button on the toolbar. You will notice
number signs appear before each list item.
Add a horizontal rule at the end of the page.
o This is a little tricky. Click at the end of the page and your blinking text-insertion
cursor should appear at the end of the last line of text, which you marked as a list
item.
o Press Enter or Return to start a new line. However, since you're in a list, the
next line will be designated as a list also. You need to "escape" the list.
o Click the bulleted list button in the toolbar to escape from the list.
o Click the H. Line button in the toolbar to insert a horizontal rule. Or choose
Insert > Horizontal Line.
Press Enter or Return to start a new line.
Add some information about how to contact the author of the page after the horizontal
rule. Just type something like: This page is maintained by Bart Everson
[[email protected]]. Substitute your own name and e-mail address for mine.
Designate the line you just typed as an address by choosing Format > Paragraph >
Address. Or you can use the pop-up menu on the toolbar.
Select the e-mail address you just typed.
Designate this selection as a link by choosing Insert > Link… or by clicking the Link
button in the toolbar.
o A dialog box should appear. In the field, enter mailto:[email protected].
Substitute your own e-mail address for mine.
o Click OK.
Make the URLs in the list of links into actual links:
o Select the URL.
o Choose Edit > Copy.
o Designate this selection as a link by choosing Insert > Link… or by clicking the
Link button in the toolbar.
o A dialog box should appear. Paste the URL you just copied into the field. Since
you can't access the Edit menu, you will have to use the keyboard shortcut, which
is Ctrl+V for Windows and Command+V for Macintosh. (The command key is
sometimes called the Apple key and is next to the spacebar.)
o Click OK.
Select the phrase 70 gallons in the second paragraph.
14
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
o Designate this selection as a bold or italic by choosing Format > Style > Bold or
Format > Style > Italic. You may also click the appropriate button in the toolbar.
Notice the lack of an emphasis or strong emphasis option.
Choose Format > Page Colors and Properties (Windows) or Format > Page
Properties (Mac).
o A dialog box should appear. Click the option marked Use Custom Colors.
o From the pop-up menu (marked Color schemes in Windows) choose Black on
Lt. Yellow.
Choose File > Save to save your work.
15
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
16
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
17
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Fill in the information as shown, substituting your own username in the User ID field.
The proper host name is webusers.xula.edu. Type in your regular Xavier e-mail
password (which will appear as ******) in the Password field.
If you are working on your own personal computer, you may also assign a Profile Name
and check the Save Password box, then click Save. This will allow you to make a
shortcut to your account in the future and not have to enter your password every time you
connect. Don't do this if you are at a shared computer!
When you're done, click OK.
After you complete the above step, the program should connect to the Xavier Web server, and if
you have the 'bells and whistles', you'll hear a sound effect of a train coming through. This is not
meant to frighten you. It's supposed to be a good thing.
18
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Take a moment to contemplate this marvel of the modern age. Notice that there are two windows.
The window on the left shows the local system; the window on the right shows the remote system.
The local system is the machine on your desktop, right in front of you. The remote system is
somewhere else — probably in a building somewhere else on campus, though theoretically it could
be anywhere from a couple yards to half a world away. In this case, the remote system is the
Xavier Web server.
You will use WS_FTP to transfer files from your local system to the remote system.
Notice the two arrow buttons between the two windows. They may look innocuous, but they're
the heart of this program. The arrow which points from left to right is used to copy local files to
the remote system. This is called as uploading. The arrow which points from right to left is used
to copy remote files to the local system. This is called as downloading.
19
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
20
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Fill in the information as shown, substituting your own username in the User ID field.
The proper host name is webusers.xula.edu. Type in your regular Xavier e-mail
password (which will appear as ******) in the Password field.
When you're done, click OK.
You should now be seeing a listing of your home directory on xavier.xula.edu.
Time for a little terminology. Let's talk about the local system and the remote system.
The local system is the machine on your desktop, right in front of you. The remote system is the
machine you just connected to, and it's somewhere else — probably in another building on
campus, though theoretically it could be anywhere from a couple yards to half a world away.
21
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
Select and Add each file you wish to upload. Select all the HTML files you created. Don't
forget to select mustard.jpg as well.
When you are finished, click Done.
Make sure the next dialog box has the following settings:
Text Files: Text
Other Files: Raw Data
Click OK.
Fetch will upload the files. When the upload is complete, the contents of myhtmltutorial in the
Fetch window should contain the files you selected for transfer.
When you are satisfied that all your materials have been transferred, proceed to section
below.
22
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
8. Cleaning Up
You probably don't want to leave these tutorial files on the server, so you may delete them.
Return to your FTP client.
Select the files you wish to delete from the remote system. Hold down the shift key to
select multiple files.
o Windows users: Click the button to the right of the Remote System Window that
is marked Delete.
o Mac users: Choose Remote > Delete Directory or File…
Click Delete in the dialog box that appears.
You may now close all running applications.
If you are doing this tutorial in a lab, you should also take a moment to clean up the desktop as a
courtesy to the next user. Simply drag your tutorial folder to the Recycle Bin (Windows) or the
Trash (Mac). Don't forget to shut down your computer and turn off the monitor.
23
How the Web Works, Part I: Introduction to HTML
HTML Tutorial
A Mustard Recipe
Ingredients
4 Tablespoons Dry mustard powder
1 Tablespoon White Wine Vinegar
2 Tablespoons Flat beer
1 Clove Garlic
1 Teaspoon Sugar
1/2 Teaspoon Salt
1/4 Teaspoon Turmeric
1 Tablespoon Olive oil -- optional
Preparation
1. Whisk together dry mustard, vinegar and beer.
2. Use a garlic press or large pair pliers to squeeze the juice from the clove of garlic into the
mixture.
3. Stir in sugar, salt and turmeric.
4. To make mustard smoother and less hot, add olive oil to taste.
Mustard Links
Européenne de Condiments
http://www.moutarde.com/
A mustard company's website
Mustard Gas
http://www.spartacus.schoolnet.co.uk/FWWmustard.htm
A description of mustard gas
Mount Horeb Mustard Museum
http://www.mustardweb.com/
The world's largest collection of prepared mustards
24