HyperText Markup Language
HTML is a simple language that was created to describe
the structure of a document. It was not intended to
specify page layout. That was to be left to individual
Web browsers. However, page layout specification
features have now been added by companies such as Microsoft
and Netscape. In addition, fierce competition has
resulted in a lot of additions to HTML and rivalry over
what features ought to be included in the next HTML
standard. I'll mostly show you HTML 2.0, even though the
current version is well beyond that. We want to concentrate
on the basics, before lots of specialized stuff was added.
When you design a Web page you want to include new
features that grab the interest of people, but at the
same time you don't want to use features that a lot of
people won't be able to see because their Web browsers
don't support them, or they are a nuisance to work with
(frames), or they are slow to load (e.g. too much sound,
photos, or other large files). You should also think of
whether you should be providing access for the handicapped,
such as the blind. Sticking to fairly basic HTML is the
safest approach, but not always the most attention-grabbing.
Here is a very basic HTML file:
This is the title. Note how it appears.
This is the body of the document.
You can write pretty much whatever you want here.
Note that your browser will word wrap these lines for
you.
That is one of the nice operations carried out by your
browser as it tries to display your file according to
its defined structure.
Of course a different browser might choose to display
the
structure in a somewhat different manner.
Copy the above example to a file, perhaps simple.html, in
your www directory. From within Linux, the directory is:
/www/YourID
(with your ID substituted for YourID, of course)
In Linux change the file's permissions so that you can view it:
chmod 644 simple.html
If you use SecureFX or similar to transfer the file from
a PC to Linux, the permissions may be OK from the start.
In Linux you can use ls -l to check file permissions in
the current directory. Note the letter l; it is not a
number 1. If the permissions are rw-r--r--, that means
read and write permission for you the owner, read permission
for your group, and read permission for everyone else. If
you interpret this as a binary number you get 110 100 100,
which is 644.
Look at the file with a browser to see how it is displayed.
The URL would be:
http://cis.stvincent.edu/YourID/simple.html
Of course, use your ID, not the literal string YourID.
Most tags, including those used above, come in pairs.
There is a <> tag to indicate the start of something
and then a > tag to indicate the end of that section.
Everything is usually contained within a pair of HTML
tags, though sometimes the > tag is optional. Note
that nearly all HTML documents would contain a HEAD
section and a BODY section.
Notice that the following would produce the same effect
on the screen, since the exact layout within the HTML
file does not matter. The final effect depends on the
HTML tags and on the particular browser.
This is the title. Note how it appears.
This is the body of the
document.
You can write pretty much whatever you want here.
Note that your browser will word wrap these lines for
you.
That is one of the nice operations carried out by your
browser as it tries to display your file according to
its defined structure.
Of course a different browser might choose to display
the
structure in a somewhat different manner.
As you can see from the above example, an HTML file is
broken into a header section and a body. One of the
main items that you would place in the header section
is a title. The title typically appears at the top of
the browser window.
Next, look at the following file. It illustrates several
new features.
Br. David's Home Page
Br. David Carlson, O.S.B.
Office location: Physics 201
Phone extension: 2416
Email address: carlsond@stvincent.edu
Br. David is a Benedictine monk of St. Vincent
Archabbey
who works in the Computing & Information
Science Department at St. Vincent College.
His main jobs are as follows:
- CIS Department Chairperson
- In Charge of the CIS Lab
- Teaches in the CIS Department
- CS101 Survey of Computers and Computing
- CS111 Computing and Information Science II
- CS221 Data Structures
- CS321 Data Communications
- CS330 Computer Architecture & Operating Systems
The stuff between is a comment. A comment
should not span multiple lines. Put comment symbols
around each line if you want a long comment of sorts.
The section marks a heading of level 1, that is, a
major heading. The end of the heading is indicated by
the
tag. You can also have a heading of level 2
by using and
, a heading of level 3, and so
forth through level 6. Most browsers display a heading
of level 1 in larger and/or bold text for emphasis. A
heading of level 2 is probably displayed in somewhat
smaller text than a heading of level 1. Usually, a
heading of level 1 is used as the first thing in the
body to repeat (or give some variation on) the title of
the document.
The tag is used to indicate the start of a
paragraph and
to indicate the end of one. (In HTML
1.0 the tag indicated the end of a paragraph
instead.) The closing
is optional, but
recommended. Many people omit it, however.