home *** CD-ROM | disk | FTP | other *** search
/ The Best Internet Programs / BESTINTERNET.bin / internet / document / beggde.txt next >
Text File  |  1995-08-06  |  32KB  |  895 lines

  1. A Beginner's Guide to HTML
  2.  
  3. This is a primer for producing documents in HTML, the markup language used by
  4. the World Wide Web.
  5.  
  6.    * Acronym Expansion
  7.    * What This Primer Doesn't Cover
  8.    * Creating HTML Documents
  9.         o The Minimal HTML Document
  10.         o Basic Markup Tags
  11.              + Titles
  12.              + Headings
  13.              + Paragraphs
  14.         o Linking to Other Documents
  15.              + Relative Links Versus Absolute Pathnames
  16.              + Uniform Resource Locator
  17.              + Anchors to Specific Sections in Other Documents
  18.              + Anchors to Specific Sections Within the Current Document
  19.    * Additional Markup Tags
  20.         o Lists
  21.              + Unnumbered Lists
  22.              + Numbered Lists
  23.              + Definition Lists
  24.              + Nested Lists
  25.         o Preformatted Text
  26.         o Extended Quotes
  27.         o Addresses
  28.    * Character Formatting
  29.         o Physical Versus Logical: Use Logical Tags When Possible
  30.              + Logical Styles
  31.              + Physical Styles
  32.         o Using Character Tags
  33.         o Special Characters
  34.              + Escape Sequences
  35.              + Forced Line Breaks
  36.              + Horizontal Rules
  37.    * In-line Images
  38.         o Alternate Text for Viewers That Can't Display Images
  39.    * External Images, Sounds, and Animations
  40.    * Troubleshooting
  41.         o Avoid Overlapping Tags
  42.         o Embed Anchors and Character Tags, But Not Anything Else
  43.         o Check Your Links
  44.    * A Longer Example
  45.    * For More Information
  46.         o Fill-out Forms
  47.         o Style Guides
  48.         o Other Introductory Documents
  49.         o Additional References
  50.  
  51. Acronym Expansion
  52.  
  53. WWW  World Wide Web (or Web, for short).
  54. SGML
  55.      Standard Generalized Markup Language -- this is a standard for describing
  56.      markup languages.
  57. DTD
  58.      Document Type Definition -- this is a specific markup language, written
  59.      using SGML.
  60. HTML
  61.      HyperText Markup Language -- HTML is a SGML DTD. In practical terms, HTML
  62.      is a collection of styles (indicated by markup tags) that define the
  63.      various components of a World Wide Web document.
  64.  
  65. What This Primer Doesn't Cover
  66.  
  67. This primer assumes that you have:
  68.  
  69.    * at least a passing knowledge of how to use NCSA Mosaic or some other Web
  70.      browser
  71.    * a general understanding of how Web servers and client browsers work
  72.    * access to a Web server for which you would like to produce HTML documents,
  73.      or that you wish to produce HTML documents for personal use
  74.  
  75. Creating HTML Documents
  76.  
  77. HTML documents are in plain (also known as ASCII) text format and can be
  78. created using any text editor (e.g., Emacs or vi on UNIX machines). A couple of
  79. Web browsers (tkWWW for X Window System machines and CERN's Web browser for
  80. NeXT computers) include rudimentary HTML editors in a WYSIWYG environment.
  81. There are also some WYSIWIG editors available now (e.g. HotMetal for Sun
  82. Sparcstations, HTML Edit for Macintoshes). You may wish to try one of them
  83. first before delving into the details of HTML.
  84.  
  85.      You can preview a document in progress with NCSA Mosaic (and some
  86.      other Web browsers). Open it with the Open Local command under the
  87.      File menu.
  88.  
  89.      After you edit the source HTML file, save the changes. Return to NCSA
  90.      Mosaic and Reload the document. The changes are reflected in the
  91.      on-screen display.
  92.  
  93. The Minimal HTML Document
  94.  
  95. Here is a bare-bones example of HTML:
  96.  
  97.     <TITLE>The simplest HTML example</TITLE>
  98.     <H1>This is a level-one heading</H1>
  99.     Welcome to the world of HTML.
  100.     This is one paragraph.<P>
  101.     And this is a second.<P>
  102.  
  103. Click here to see the formatted version of the example.
  104.  
  105. HTML uses markup tags to tell the Web browser how to display the text. The
  106. above example uses:
  107.  
  108.    * the <TITLE> tag (and corresponding </TITLE> tag), which specifies the
  109.      title of the document
  110.    * the <H1> header tag (and corresponding </H1>)
  111.    * the <P> paragraph-separator tag
  112.  
  113. HTML tags consist of a left angle bracket (<), (a ``less than'' symbol to
  114. mathematicians), followed by name of the tag and closed by a right angular
  115. bracket (>). Tags are usually paired, e.g. <H1> and </H1>. The ending tag looks
  116. just like the starting tag except a slash (/) precedes the text within the
  117. brackets. In the example, <H1> tells the Web browser to start formatting a
  118. level-one heading; </H1> tells the browser that the heading is complete.
  119.  
  120. The primary exception to the pairing rule is the <P> tag. There is no such
  121. thing as </P>.
  122.  
  123. NOTE: HTML is not case sensitive. <title> is equivalent to <TITLE> or <TiTlE>.
  124.  
  125. Not all tags are supported by all World Wide Web browsers. If a browser does
  126. not support a tag, it just ignores it.
  127.  
  128. Basic Markup Tags
  129.  
  130. Title
  131.  
  132. Every HTML document should have a title. A title is generally displayed
  133. separately from the document and is used primarily for document identification
  134. in other contexts (e.g., a WAIS search). Choose about half a dozen words that
  135. describe the document's purpose.
  136.  
  137.      In the X Window System and Microsoft Windows versions of NCSA Mosaic,
  138.      the Document Title field is at the top of the screen just below the
  139.      pulldown menus. In NCSA Mosaic for Macintosh, text tagged as <TITLE>
  140.      appears as the window title.
  141.  
  142. Headings
  143.  
  144. HTML has six levels of headings, numbered 1 through 6, with 1 being the most
  145. prominent. Headings are displayed in larger and/or bolder fonts than normal
  146. body text. The first heading in each document should be tagged <H1>. The syntax
  147. of the heading tag is:
  148.  
  149. <Hy>Text of heading </Hy >
  150.  
  151. where y is a number between 1 and 6 specifying the level of the heading.
  152.  
  153. For example, the coding for the ``Headings'' section heading above is
  154.  
  155.     <H3>Headings</H3>
  156.  
  157. Title versus first heading
  158.  
  159. In many documents, the first heading is identical to the title. For multipart
  160. documents, the text of the first heading should be suitable for a reader who is
  161. already browsing related information (e.g., a chapter title), while the title
  162. tag should identify the document in a wider context (e.g., include both the
  163. book title and the chapter title, although this can sometimes become overly
  164. long).
  165.  
  166. Paragraphs
  167.  
  168. Unlike documents in most word processors, carriage returns in HTML files aren't
  169. significant. Word wrapping can occur at any point in your source file, and
  170. multiple spaces are collapsed into a single space. (There are couple of
  171. exceptions; space following a <P> or <Hy> tag, for example, is ignored.) Notice
  172. that in the bare-bones example, the first paragraph is coded as
  173.  
  174.     Welcome to HTML.
  175.     This is the first paragraph. <P>
  176.  
  177. In the source file, there is a line break between the sentences. A Web browser
  178. ignores this line break and starts a new paragraph only when it reaches a <P>
  179. tag.
  180.  
  181. Important: You must separate paragraphs with <P>. The browser ignores any
  182. indentations or blank lines in the source text. HTML relies almost entirely on
  183. the tags for formatting instructions, and without the <P> tags, the document
  184. becomes one large paragraph. (The exception is text tagged as ``preformatted,''
  185. which is explained below.) For instance, the following would produce identical
  186. output as the first bare-bones HTML example:
  187.  
  188.     <TITLE>The simplest HTML example</TITLE><H1>This is a level
  189.     one heading</H1>Welcome to the world of HTML. This is one
  190.     paragraph.<P>And this is a second.<P>
  191.  
  192. However, to preserve readability in HTML files, headings should be on separate
  193. lines, and paragraphs should be separated by blank lines (in addition to the
  194. <P> tags).
  195.  
  196.      NCSA Mosaic handles <P> by ending the current paragraph and inserting
  197.      a blank line.
  198.  
  199. In HTML+, a successor to HTML currently in development, <P> becomes a
  200. ``container'' of text, just as the text of a level-one heading is ``contained''
  201. within<H1> ... </H1>:
  202.  
  203.     <P>
  204.     This is a paragraph in HTML+.
  205.     </P>
  206.  
  207. The difference is that the </P> closing tag can always be omitted. (That is, if
  208. a browser sees a <P>, it knows that there must be an implied </P> to end the
  209. previous paragraph.) In other words, in H