home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best Internet Programs
/
BESTINTERNET.bin
/
internet
/
document
/
beggde.txt
next >
Wrap
Text File
|
1995-08-06
|
32KB
|
895 lines
A Beginner's Guide to HTML
This is a primer for producing documents in HTML, the markup language used by
the World Wide Web.
* Acronym Expansion
* What This Primer Doesn't Cover
* Creating HTML Documents
o The Minimal HTML Document
o Basic Markup Tags
+ Titles
+ Headings
+ Paragraphs
o Linking to Other Documents
+ Relative Links Versus Absolute Pathnames
+ Uniform Resource Locator
+ Anchors to Specific Sections in Other Documents
+ Anchors to Specific Sections Within the Current Document
* Additional Markup Tags
o Lists
+ Unnumbered Lists
+ Numbered Lists
+ Definition Lists
+ Nested Lists
o Preformatted Text
o Extended Quotes
o Addresses
* Character Formatting
o Physical Versus Logical: Use Logical Tags When Possible
+ Logical Styles
+ Physical Styles
o Using Character Tags
o Special Characters
+ Escape Sequences
+ Forced Line Breaks
+ Horizontal Rules
* In-line Images
o Alternate Text for Viewers That Can't Display Images
* External Images, Sounds, and Animations
* Troubleshooting
o Avoid Overlapping Tags
o Embed Anchors and Character Tags, But Not Anything Else
o Check Your Links
* A Longer Example
* For More Information
o Fill-out Forms
o Style Guides
o Other Introductory Documents
o Additional References
Acronym Expansion
WWW World Wide Web (or Web, for short).
SGML
Standard Generalized Markup Language -- this is a standard for describing
markup languages.
DTD
Document Type Definition -- this is a specific markup language, written
using SGML.
HTML
HyperText Markup Language -- HTML is a SGML DTD. In practical terms, HTML
is a collection of styles (indicated by markup tags) that define the
various components of a World Wide Web document.
What This Primer Doesn't Cover
This primer assumes that you have:
* at least a passing knowledge of how to use NCSA Mosaic or some other Web
browser
* a general understanding of how Web servers and client browsers work
* access to a Web server for which you would like to produce HTML documents,
or that you wish to produce HTML documents for personal use
Creating HTML Documents
HTML documents are in plain (also known as ASCII) text format and can be
created using any text editor (e.g., Emacs or vi on UNIX machines). A couple of
Web browsers (tkWWW for X Window System machines and CERN's Web browser for
NeXT computers) include rudimentary HTML editors in a WYSIWYG environment.
There are also some WYSIWIG editors available now (e.g. HotMetal for Sun
Sparcstations, HTML Edit for Macintoshes). You may wish to try one of them
first before delving into the details of HTML.
You can preview a document in progress with NCSA Mosaic (and some
other Web browsers). Open it with the Open Local command under the
File menu.
After you edit the source HTML file, save the changes. Return to NCSA
Mosaic and Reload the document. The changes are reflected in the
on-screen display.
The Minimal HTML Document
Here is a bare-bones example of HTML:
<TITLE>The simplest HTML example</TITLE>
<H1>This is a level-one heading</H1>
Welcome to the world of HTML.
This is one paragraph.<P>
And this is a second.<P>
Click here to see the formatted version of the example.
HTML uses markup tags to tell the Web browser how to display the text. The
above example uses:
* the <TITLE> tag (and corresponding </TITLE> tag), which specifies the
title of the document
* the <H1> header tag (and corresponding </H1>)
* the <P> paragraph-separator tag
HTML tags consist of a left angle bracket (<), (a ``less than'' symbol to
mathematicians), followed by name of the tag and closed by a right angular
bracket (>). Tags are usually paired, e.g. <H1> and </H1>. The ending tag looks
just like the starting tag except a slash (/) precedes the text within the
brackets. In the example, <H1> tells the Web browser to start formatting a
level-one heading; </H1> tells the browser that the heading is complete.
The primary exception to the pairing rule is the <P> tag. There is no such
thing as </P>.
NOTE: HTML is not case sensitive. <title> is equivalent to <TITLE> or <TiTlE>.
Not all tags are supported by all World Wide Web browsers. If a browser does
not support a tag, it just ignores it.
Basic Markup Tags
Title
Every HTML document should have a title. A title is generally displayed
separately from the document and is used primarily for document identification
in other contexts (e.g., a WAIS search). Choose about half a dozen words that
describe the document's purpose.
In the X Window System and Microsoft Windows versions of NCSA Mosaic,
the Document Title field is at the top of the screen just below the
pulldown menus. In NCSA Mosaic for Macintosh, text tagged as <TITLE>
appears as the window title.
Headings
HTML has six levels of headings, numbered 1 through 6, with 1 being the most
prominent. Headings are displayed in larger and/or bolder fonts than normal
body text. The first heading in each document should be tagged <H1>. The syntax
of the heading tag is:
<Hy>Text of heading </Hy >
where y is a number between 1 and 6 specifying the level of the heading.
For example, the coding for the ``Headings'' section heading above is
<H3>Headings</H3>
Title versus first heading
In many documents, the first heading is identical to the title. For multipart
documents, the text of the first heading should be suitable for a reader who is
already browsing related information (e.g., a chapter title), while the title
tag should identify the document in a wider context (e.g., include both the
book title and the chapter title, although this can sometimes become overly
long).
Paragraphs
Unlike documents in most word processors, carriage returns in HTML files aren't
significant. Word wrapping can occur at any point in your source file, and
multiple spaces are collapsed into a single space. (There are couple of
exceptions; space following a <P> or <Hy> tag, for example, is ignored.) Notice
that in the bare-bones example, the first paragraph is coded as
Welcome to HTML.
This is the first paragraph. <P>
In the source file, there is a line break between the sentences. A Web browser
ignores this line break and starts a new paragraph only when it reaches a <P>
tag.
Important: You must separate paragraphs with <P>. The browser ignores any
indentations or blank lines in the source text. HTML relies almost entirely on
the tags for formatting instructions, and without the <P> tags, the document
becomes one large paragraph. (The exception is text tagged as ``preformatted,''
which is explained below.) For instance, the following would produce identical
output as the first bare-bones HTML example:
<TITLE>The simplest HTML example</TITLE><H1>This is a level
one heading</H1>Welcome to the world of HTML. This is one
paragraph.<P>And this is a second.<P>
However, to preserve readability in HTML files, headings should be on separate
lines, and paragraphs should be separated by blank lines (in addition to the
<P> tags).
NCSA Mosaic handles <P> by ending the current paragraph and inserting
a blank line.
In HTML+, a successor to HTML currently in development, <P> becomes a
``container'' of text, just as the text of a level-one heading is ``contained''
within<H1> ... </H1>:
<P>
This is a paragraph in HTML+.
</P>
The difference is that the </P> closing tag can always be omitted. (That is, if
a browser sees a <P>, it knows that there must be an implied </P> to end the
previous paragraph.) In other words, in H