home *** CD-ROM | disk | FTP | other *** search
/ ABCD Interaktív Magazin 1995 #2 / ABCD.ISO / abcd / muhely / html / bguide next >
Encoding:
Text File  |  1995-04-12  |  31.3 KB  |  893 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.       The Minimal HTML Document 
  10.       Basic Markup Tags 
  11.          Titles 
  12.          Headings 
  13.          Paragraphs 
  14.       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.       Lists 
  21.          Unnumbered Lists 
  22.          Numbered Lists 
  23.          Definition Lists 
  24.          Nested Lists 
  25.       Preformatted Text 
  26.       Extended Quotes 
  27.       Addresses 
  28.    Character Formatting 
  29.       Physical Versus Logical: Use Logical Tags When Possible 
  30.          Logical Styles 
  31.          Physical Styles 
  32.       Using Character Tags 
  33.       Special Characters 
  34.          Escape Sequences 
  35.          Forced Line Breaks 
  36.          Horizontal Rules 
  37.    In-line Images 
  38.       Alternate Text for Viewers That Can't Display Images 
  39.    External Images, Sounds, and Animations 
  40.    Troubleshooting 
  41.       Avoid Overlapping Tags 
  42.       Embed Anchors and Character Tags, But Not Anything Else 
  43.       Check Your Links 
  44.    A Longer Example 
  45.    For More Information 
  46.       Fill-out Forms 
  47.       Style Guides 
  48.       Other Introductory Documents 
  49.       Additional References 
  50.  
  51. Acronym Expansion
  52.  
  53. WWW 
  54.    World Wide Web (or Web, for short). 
  55. SGML 
  56.    Standard Generalized Markup Language -- this is a standard for describing
  57.    markup languages. 
  58. DTD 
  59.    Document Type Definition -- this is a specific markup language, written using
  60.    SGML. 
  61. HTML 
  62.    HyperText Markup Language -- HTML is a SGML DTD. In practical terms, HTML is
  63.    a collection of styles (indicated by markup tags) that define the various
  64.    components of a World Wide Web document. 
  65.  
  66. What This Primer Doesn't Cover
  67.  
  68. This primer assumes that you have: 
  69.  
  70.    at least a passing knowledge of how to use NCSA Mosaic or some other Web
  71.    browser 
  72.    a general understanding of how Web servers and client browsers work 
  73.    access to a Web server for which you would like to produce HTML documents, or
  74.    that you wish to produce HTML documents for personal use 
  75.  
  76. Creating HTML Documents
  77.  
  78. HTML documents are in plain (also known as ASCII) text format and can be created
  79. using any text editor (e.g., Emacs or vi on UNIX machines). A couple of Web
  80. browsers (tkWWW for X Window System machines and CERN's Web browser for NeXT
  81. computers) include rudimentary HTML editors in a WYSIWYG environment. There are
  82. also some WYSIWIG editors available now (e.g. HotMetal for Sun Sparcstations,
  83. HTML Edit for Macintoshes). You may wish to try one of them first before delving
  84. into the details of HTML. 
  85.  
  86.   You can preview a document in progress with NCSA Mosaic (and some other
  87.   Web browsers). Open it with the Open Local command under the 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 on-screen
  91.   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 above
  106. example uses: 
  107.  
  108.    the <TITLE> tag (and corresponding </TITLE> tag), which specifies the title
  109.    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 thing
  121. 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 not
  126. 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, the 
  138.   Document Title field is at the top of the screen just below the pulldown
  139.   menus. In NCSA Mosaic for Macintosh, text tagged as <TITLE> appears as the
  140.   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 body
  146. text. The first heading in each document should be tagged <H1>. The syntax of
  147. 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 book
  163. title and the chapter title, although this can sometimes become overly long). 
  164.  
  165. Paragraphs
  166.  
  167. Unlike documents in most word processors, carriage returns in HTML files aren't
  168. significant. Word wrapping can occur at any point in your source file, and
  169. multiple spaces are collapsed into a single space. (There are couple of
  170. exceptions; space following a <P> or <Hy> tag, for example, is ignored.) Notice
  171. that in the bare-bones example, the first paragraph is coded as 
  172.  
  173.     Welcome to HTML.
  174.     This is the first paragraph. <P>
  175.  
  176. In the source file, there is a line break between the sentences. A Web browser
  177. ignores this line break and starts a new paragraph only when it reaches a <P>
  178. tag. 
  179.  
  180. Important: You must separate paragraphs with <P>. The browser ignores any
  181. indentations or blank lines in the source text. HTML relies almost entirely on
  182. the tags for formatting instructions, and without the <P> tags, the document
  183. becomes one large paragraph. (The exception is text tagged as ``preformatted,''
  184. which is explained below.) For instance, the following would produce identical
  185. output as the first bare-bones HTML example: 
  186.  
  187.     <TITLE>The simplest HTML example</TITLE><H1>This is a level 
  188.     one heading</H1>Welcome to the world of HTML. This is one 
  189.     paragraph.<P>And this is a second.<P>
  190.  
  191. However, to preserve readability in HTML files, headings should be on separate
  192. lines, and paragraphs should be separated by blank lines (in addition to the <P>
  193. tags). 
  194.  
  195.   NCSA Mosaic handles <P> by ending the current paragraph and inserting a
  196.   blank line. 
  197.  
  198. In HTML+, a successor to HTML currently in development, <P> becomes a
  199. ``container'' of text, just as the text of a level-one heading is ``contained''
  200. within<H1> ... </H1>: 
  201.  
  202.     <P>
  203.     This is a paragraph in HTML+.
  204.     </P>
  205.  
  206. The difference is that the </P> closing tag can always be omitted. (That is, if
  207. a browser sees a <P>, it knows that there must be an implied </P> to end the
  208. previous paragraph.) In other words, in HTML+, <P> is a beginning-of-paragraph
  209. marker. 
  210.  
  211. The advantage of this change is that you will be able to specify formatting
  212. options for a paragraph. For example, in HTML+, you will be able to center a
  213. paragraph by coding 
  214.  
  215.     <P ALIGN=CENTER>
  216.     This is a centered paragraph. This is HTML+, so you can't do it yet.
  217.  
  218. This change won't effect any documents you write now, and they will continue to
  219. look just the same with HTML+ browsers. 
  220.  
  221. Linking to Other Documents
  222.  
  223. The chief power of HTML comes from its ability to link regions of text (and also
  224. images) to another document. The browser highlights these regions (usually with
  225. color and/or underlines) to indicate that they are hypertext links (often
  226. shortened to hyperlinks or simply links). 
  227.  
  228. HTML's single hypertext-related tag is <A>, which stands for anchor. To include
  229. an anchor in your document: 
  230.  
  231. 1. Start the anchor with <A . (There's a space after the A.) 
  232. 2. Specify the document that's being pointed to by entering the parameter HREF="
  233.    filename" followed by a closing right angle bracket: > 
  234. 3. Enter the text that will serve as the hypertext link in the current document.
  235. 4. Enter the ending anchor tag: </A>. 
  236.  
  237. Here is an sample hypertext reference: 
  238.  
  239.     <A HREF="MaineStats.html">Maine</A>
  240.  
  241. This entry makes the word ``Maine'' the hyperlink to the document 
  242. MaineStats.html, which is in the same directory as the first document. You can
  243. link to documents in other directories by specifying the relative path from the
  244. current document to the linked document. For example, a link to a file 
  245. NJStats.html located in the subdirectory AtlanticStates would be: 
  246.  
  247.     <A HREF="AtlanticStates/NJStats.html">New Jersey</A>
  248.  
  249. These are called relative links. You can also use the absolute pathname of the
  250. file if you wish. Pathnames use the standard UNIX syntax. 
  251.  
  252. Relative Links Versus Absolute Pathnames
  253.  
  254. In general, you should use relative links, because 
  255.  
  256. 1. You have less to type. 
  257. 2. It's easier to move a group of documents to another location, because the
  258.    relative path names will still be valid. 
  259.  
  260. However, use absolute pathnames when linking to documents that are not directly
  261. related. For example, consider a group of documents that comprise a user manual.
  262. Links within this group should be relative links. Links to other documents
  263. (perhaps a reference to related software) should use full path names. This way,
  264. if you move the user manual to a different directory, none of the links would
  265. have to be updated. 
  266.  
  267. Uniform Resource Locator
  268.  
  269. The World Wide Web uses Uniform Resource Locators (URLs) to specify the location
  270. of files on other servers. A URL includes the type of resource being accessed
  271. (e.g., gopher, WAIS), the address of the server, and the location of the file.
  272. The syntax is: 
  273.  
  274. scheme://host.domain[:port]/path/filename 
  275.  
  276. where scheme is one of 
  277.  
  278. file 
  279.    a file on your local system, or a file on an anonymous FTP server 
  280. http 
  281.    a file on a World Wide Web server 
  282. gopher 
  283.    a file on a Gopher server 
  284. WAIS 
  285.    a file on a WAIS server 
  286. news 
  287.    an Usenet newsgroup 
  288. telnet 
  289.    a connection to a Telnet-based service 
  290.  
  291. The port number can generally be omitted. (That means unless someone tells you
  292. otherwise, leave it out.) 
  293.  
  294. For example, to include a link to this primer in your document, you would use 
  295.  
  296.     <A HREF = "http://www.ncsa.uiuc.edu/General/Internet/WWW/HTMLPrimer.html"> 
  297.     NCSA's Beginner's Guide to HTML</A>
  298.  
  299. This would make the text ``NCSA's Beginner's Guide to HTML'' a hyperlink to this
  300. document. 
  301.  
  302. For more information on URLs, look at 
  303.  
  304.    WWW Names and Addresses, URIs, URLs, URNs, written by people at CERN 
  305.    A Beginner's Guide to URLs, located on the NCSA Mosaic Help menu 
  306.  
  307. Links to Specific Sections in Other Documents
  308.  
  309. Anchors can also be used to move to a particular section in a document. Suppose
  310. you wish to set a link from document A and a specific section in document B.
  311. (Call this file documentB.html.) First you need to set up a named anchor in
  312. document B. For example, to set up an anchor named ``Jabberwocky'' to document
  313. B, enter 
  314.  
  315.     Here's <A NAME = "Jabberwocky">some text</a>
  316.  
  317. Now when you create the link in document A, include not only the filename, but
  318. also the named anchor, separated by a hash mark (#). 
  319.  
  320.     This is my <A HREF = "documentB.html#Jabberwocky">link</A> to document B.
  321.  
  322. Now clicking on the word ``link'' in document A sends the reader directly to the
  323. words ``some text'' in document B. 
  324.  
  325. Links to Specific Sections Within the Current Document
  326.  
  327. The technique is exactly the same except the filename is omitted. 
  328.  
  329. For example, to link to the Jabberwocky anchor from within the same file
  330. (Document B), use 
  331.  
  332.     This is <A HREF = "#Jabberwocky">Jabberwocky link</A> from within Document B.
  333.  
  334. Additional Markup Tags
  335.  
  336. The preceding is sufficient to produce simple HTML documents. For more complex
  337. documents, HTML has tags for several types of lists, preformatted sections,
  338. extended quotations, character formatting, and other items. 
  339.  
  340. Lists
  341.  
  342. HTML supports unnumbered, numbered, and definition lists. 
  343.  
  344. Unnumbered Lists
  345.  
  346. To make an unnumbered list, 
  347.  
  348. 1. Start with an opening list <UL> tag. 
  349. 2. Enter the <LI> tag followed by the individual item. (No closing </LI> tag is
  350.    needed.) 
  351. 3. End with a closing list </UL> tag. 
  352.  
  353. Below an example two-item list: 
  354.  
  355.     <UL>
  356.     <LI> apples
  357.     <LI> bananas
  358.     </UL>
  359.  
  360. The output is: 
  361.  
  362.    apples 
  363.    bananas 
  364.  
  365. The <LI> items can contain multiple paragraphs. Just separate the paragraphs
  366. with the <P> paragraph tags. 
  367.  
  368. Numbered Lists
  369.  
  370. A numbered list (also called an ordered list, from which the tag name derives)
  371. is identical to an unnumbered list, except it uses <OL> instead of <UL>. The
  372. items are tagged using the same <LI> tag. The following HTML code 
  373.  
  374.     <OL>
  375.     <LI> oranges
  376.     <LI> peaches
  377.     <LI> grapes
  378.     </OL>
  379.  
  380. produces this formatted output: 
  381.  
  382. 1. oranges 
  383. 2. peaches 
  384. 3. grapes 
  385.  
  386. Definition Lists 
  387.  
  388. A definition list usually consists of alternating a term (abbreviated as DT) and
  389. a definition (abbreviated as DD). Web browsers generally format the definition
  390. on a new line. 
  391.  
  392. The following is an example of a definition list: 
  393.  
  394.     <DL>
  395.     <DT> NCSA
  396.     <DD> NCSA, the National Center for Supercomputing Applications,
  397.          is located on the campus of the University of Illinois 
  398.          at Urbana-Champaign. NCSA is one of the participants in the
  399.          National MetaCenter for Computational Science and Engineering.
  400.     <DT> Cornell Theory Center
  401.     <DD> CTC is located on the campus of Cornell University in Ithaca,
  402.          New York. CTC is another participant in the National MetaCenter
  403.          for Computational Science and Engineering.
  404.     </DL>
  405.  
  406. The output looks like: 
  407.  
  408. NCSA 
  409.    NCSA, the National Center for Supercomputing Applications, is located on the
  410.    campus of the University of Illinois at Urbana-Champaign. NCSA is one of the
  411.    participants in the National MetaCenter for Computational Science and
  412.    Engineering. 
  413. Cornell Theory Center 
  414.    CTC is located on the campus of Cornell University in Ithaca, New York. CTC
  415.    is another participant in the National MetaCenter for Computational Science
  416.    and Engineering. 
  417.  
  418. The <DT> and <DD> entries can contain multiple paragraphs (separated by <P>
  419. paragraph tags), lists, or other definition information. 
  420.  
  421. Nested Lists
  422.  
  423. Lists can be arbitrarily nested, although in practice you probably should limit
  424. the nesting to three levels. You can also have a number of paragraphs, each
  425. containing a nested list, in a single list item. 
  426.  
  427. An example nested list: 
  428.  
  429.     <UL>
  430.     <LI> A few New England states:
  431.         <UL>
  432.         <LI> Vermont
  433.         <LI> New Hampshire
  434.         </UL>
  435.     <LI> One Midwestern state:
  436.         <UL>
  437.         <LI> Michigan
  438.         </UL>
  439.     </UL>
  440.  
  441. The nested list is displayed as 
  442.  
  443.    A few New England states: 
  444.       Vermont 
  445.       New Hampshire 
  446.    One Midwestern state: 
  447.       Michigan 
  448.  
  449. Preformatted Text
  450.  
  451. Use the <PRE> tag (which stands for ``preformatted'') to generate text in a
  452. fixed-width font and cause spaces, new lines, and tabs to be significant. (That
  453. is, multiple spaces are displayed as multiple spaces, and lines break in the
  454. same locations as in the source HTML file.) This is useful for program listings.
  455. For example, the following lines 
  456.  
  457.     <PRE>
  458.       #!/bin/csh                           
  459.       cd $SCR                             
  460.       cfs get mysrc.f:mycfsdir/mysrc.f   
  461.       cfs get myinfile:mycfsdir/myinfile   
  462.       fc -02 -o mya.out mysrc.f           
  463.       mya.out                              
  464.       cfs save myoutfile:mycfsdir/myoutfile 
  465.       rm *                                
  466.     </PRE>
  467.  
  468. display as 
  469.  
  470.       #!/bin/csh                           
  471.       cd $SCR                             
  472.       cfs get mysrc.f:mycfsdir/mysrc.f   
  473.       cfs get myinfile:mycfsdir/myinfile   
  474.       fc -02 -o mya.out mysrc.f           
  475.       mya.out                              
  476.       cfs save myoutfile:mycfsdir/myoutfile 
  477.       rm *
  478.  
  479. Hyperlinks can be used within <PRE> sections. You should avoid using other HTML
  480. tags within <PRE> sections, however. 
  481.  
  482. Note that because <, >, and & have special meaning in HTML, you have to use
  483. their escape sequences (<, >, and &, respectively) to enter these
  484. characters. See the section Special Characters for more information. 
  485.  
  486. Extended Quotations
  487.  
  488. Use the <BLOCKQUOTE> tag to include quotations in a separate block on the
  489. screen. Most browsers generally indent to separate it from surrounding text. 
  490.  
  491. An example: 
  492.  
  493.     <BLOCKQUOTE>
  494.     I still have a dream. It is a dream deeply rooted in the
  495.     American dream. <P>
  496.     I have a dream that one day this nation will rise up and 
  497.     live out the true meaning of its creed. We hold these truths 
  498.     to be self-evident that all men are created equal. <P>
  499.     </BLOCKQUOTE>
  500.  
  501. The result is: 
  502.  
  503.   I still have a dream. It is a dream deeply rooted in the American dream. 
  504.  
  505.   I have a dream that one day this nation will rise up and live out the true
  506.   meaning of its creed. We hold these truths to be self-evident that all men
  507.   are created equal. 
  508.  
  509. Addresses
  510.  
  511. The <ADDRESS> tag is generally used to specify the author of a document and a
  512. means of contacting the author (e.g., an email address). This is usually the
  513. last item in a file. 
  514.  
  515. For example, the last line of the online version of this guide is 
  516.  
  517.     <ADDRESS>
  518.     A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu
  519.     </ADDRESS>
  520.  
  521. The result is 
  522. A Beginner's Guide to HTML / NCSA / pubs@ncsa.uiuc.edu 
  523.  
  524. NOTE: <ADDRESS> is not used for postal addresses. See ``Forced Line Breaks'' on
  525. page 10 to see how to format postal addresses. 
  526.  
  527. Character Formatting
  528.  
  529. You can code individual words or sentences with special styles. There are two
  530. types of styles: logical and physical. Logical styles tag text according to its
  531. meaning, while physical styles specify the specific appearance of a section. For
  532. example, in the preceding sentence, the words ``logical styles'' was tagged as a
  533. ``definition.'' The same effect (formatting those words in italics), could have
  534. been achieved via a different tag that specifies merely ``put these words in
  535. italics.'' 
  536.  
  537. Physical Versus Logical: Use Logical Styles When Possible
  538.  
  539. If physical and logical styles produce the same result on the screen, why are
  540. there both? We devolve, for a couple of paragraphs, into the philosophy of SGML,
  541. which can be summed in a Zen-like mantra: ``Trust your browser.'' 
  542.  
  543. In the ideal SGML universe, content is divorced from presentation. Thus, SGML
  544. tags a level-one heading as a level-one heading, but does not specify that the
  545. level-one heading should be, for instance, 24-point bold Times centered on the
  546. top of a page. The advantage of this approach (it's similar in concept to style
  547. sheets in many word processors) is that if you decide to change level-one
  548. headings to be 20-point left-justified Helvetica, all you have to do is change
  549. the definition of the level-one heading in the presentation device (i.e., your
  550. World Wide Web browser). 
  551.  
  552. The other advantage of logical tags is that they help enforce consistency in
  553. your documents. It's easier to tag something as <H1> than to remember that
  554. level-one headings are 24-point bold Times or whatever. The same is true for
  555. character styles. For example, consider the <STRONG> tag. Most browsers render
  556. it in bold text. However, it is possible that a reader would prefer that these
  557. sections be displayed in red instead. Logical styles offer this flexibility. 
  558.  
  559. Logical Styles
  560.  
  561. <DFN> 
  562.    for a word being defined. Typically displayed in italics. (NCSA Mosaic is a
  563.    World Wide Web browser.) 
  564. <EM> 
  565.    for emphasis. Typically displayed in italics. (Watch out for pickpockets.) 
  566. <CITE> 
  567.    for titles of books, films, etc. Typically displayed in italics. (A 
  568.    Beginner's Guide to HTML) 
  569. <CODE> 
  570.    for snippets of computer code. Displayed in a fixed-width font. (The 
  571.    <stdio.h> header file) 
  572. <KBD> 
  573.    for user keyboard entry. Should be displayed in a bold fixed-width font, but
  574.    many browsers render it in the plain fixed-width font. (Enter passwd to
  575.    change your password.) 
  576. <SAMP> 
  577.    for computer status messages. Displayed in a fixed-width font. (Segmentation
  578.    fault: Core dumped.) 
  579. <STRONG> 
  580.    for strong emphasis. Typically displayed in bold. (Important) 
  581. <VAR> 
  582.    for a ``metasyntactic'' variable, where the user is to replace the variable
  583.    with a specific instance. Typically displayed in italics. (rm filename
  584.    deletes the file.) 
  585.  
  586. Physical Styles
  587.  
  588. <B> 
  589.    bold text 
  590. <I> 
  591.    italic text 
  592. <TT> 
  593.    typewriter text, e.g. fixed-width font. 
  594.  
  595. Using Character Tags
  596.  
  597. To apply a character style, 
  598.  
  599. 1. Start with <tag>, where tag is the desired character formatting tag, to
  600.    indicate the beginning of the tagged text. 
  601. 2. Enter the tagged text. 
  602. 3. End the passage with </tag>. 
  603.  
  604. Special Characters
  605.  
  606. Escape Sequences
  607.  
  608. Four characters of the ASCII character set -- the left angle bracket (<), the
  609. right angle bracket (>), the ampersand (&) and the double quote (") -- have
  610. special meaning within HTML and therefore cannot be used ``as is'' in text. (The
  611. angle brackets are used to indicate the beginning and end of HTML tags, and the
  612. ampersand is used to indicate the beginning of an escape sequence.) 
  613.  
  614. To use one of these characters in an HTML document, you must enter its escape 
  615. sequence instead: 
  616.  
  617.    the escape sequence for < 
  618.    the escape sequence for > 
  619.    the escape sequence for & 
  620.    the escape sequence for " 
  621.  
  622. Additional escape sequences support accented characters. For example: 
  623.  
  624. ö 
  625.    the escape sequence for a lowercase o with an umlaut: ÷ 
  626. ñ 
  627.    the escape sequence for a lowercase n with an tilde: ± 
  628. È 
  629.    the escape sequence for an uppercase E with a grave accent: ╚ 
  630.  
  631. A full list of supported characters can be found at CERN. 
  632.  
  633. NOTE: Unlike the rest of HTML, the escape sequences are case sensitive. You
  634. cannot, for instance, use < instead of <. 
  635.  
  636. Forced Line Breaks
  637.  
  638. The <BR> tag forces a line break with no extra space between lines. (By
  639. contrast, most browsers format the <P> paragraph tag with an additional blank
  640. line to more clearly indicate the beginning the new paragraph.) 
  641.  
  642. One use of <BR> is in formatting addresses: 
  643.  
  644.     National Center for Supercomputing Applications<BR>
  645.     605 East Springfield Avenue<BR>
  646.     Champaign, Illinois 61820-5518<BR>
  647.  
  648. Horizontal Rules
  649.  
  650. The <HR> tag produces a horizontal line the width of the browser window. 
  651.  
  652. In-line Images
  653.  
  654. Most Web browsers can display in-line images (that is, images next to text) that
  655. are in X Bitmap (XBM) or GIF format. Each image takes time to process and slows
  656. down the initial display of the document, so generally you should not include
  657. too many or overly large images. 
  658.  
  659. To include an in-line image, use 
  660.  
  661.     <IMG SRC=image_URL>
  662.  
  663. where image_URL is the URL of the image file. The syntax for IMG SRC URLs is
  664. identical to that used in an anchor HREF. If the image file is a GIF file, then
  665. the filename part of image_URL must end with .gif. Filenames of X Bitmap images
  666. must end with .xbm. 
  667.  
  668.             By default the bottom of an image is aligned with the text as shown
  669. in this paragraph. 
  670.  
  671.              Add the ALIGN=TOP option if you want the browser to align adjacent
  672. text with the top of the image as shown in this paragraph. The full in-line
  673. image tag with the top alignment is: 
  674.  
  675.     <IMG ALIGN=top SRC=image_URL>
  676.  
  677.              ALIGN=MIDDLE aligns the text with the center of the image. 
  678.  
  679. Alternate Text for Browsers That Can't Display Images
  680.  
  681. Some World Wide Web browsers, primarily those that run on VT100 terminals,
  682. cannot display images. The ALT option allows you to specify text to be displayed
  683. when an image cannot be. For example: 
  684.  
  685.     <IMG SRC = "UpArrow.gif" ALT = "Up">
  686.  
  687. where UpArrow.gif is the picture of an upward pointing arrow. With NCSA Mosaic
  688. and other graphics-capable viewers, the user sees the up arrow graphic. With a
  689. VT100 browser, such as lynx, the user sees the word ``Up.'' 
  690.  
  691. External Images, Sounds, and Animations
  692.  
  693. You may want to have an image open as a separate document when a user activates
  694. a link on either a word or a smaller, in-line version of the image included in
  695. your document. This is considered an external image and is useful if you do not
  696. wish to slow down the loading of the main document with large in-line images. 
  697.  
  698. To include a reference to an external image, use 
  699.  
  700.     <A HREF = image_URL>link anchor</A>
  701.  
  702. Use the same syntax is for links to external animations and sounds. The only
  703. difference is the file extension of the linked file. For example, 
  704.  
  705. <A HREF = "QuickTimeMovie.mov">link anchor</A> 
  706.  
  707. specifies a link to a QuickTime movie. Some common file types and their
  708. extensions are: 
  709.  
  710. File Type 
  711.    Extension 
  712. Plain text 
  713.    .txt 
  714. HTML document 
  715.    .html 
  716. GIF image 
  717.    .gif 
  718. TIFF image 
  719.    .tiff 
  720. XBM bitmap image 
  721.    .xbm 
  722. JPEG image 
  723.    .jpg or .jpeg 
  724. PostScript file 
  725.    .ps 
  726. AIFF sound 
  727.    .aiff 
  728. AU sound 
  729.    .au 
  730. QuickTime movie 
  731.    .mov 
  732. MPEG movie 
  733.    .mpeg or .mpg 
  734.  
  735. Make sure your intended audience has the necessary viewers. Most UNIX
  736. workstations, for instance, cannot view QuickTime movies. 
  737.  
  738. Troubleshooting
  739.  
  740. Avoid Overlapping Tags
  741.  
  742. Consider this snippet of HTML: 
  743.  
  744.     <B>This is an example of <DFN>overlapping</B> HTML tags.</DFN>
  745.  
  746. The word ``overlapping'' is contained within both the <B> and <DFN> tags. How
  747. does the browser format it? You won't know until you look, and different
  748. browsers will likely react differently. In general, avoid overlapping tags. 
  749.  
  750. Embed Anchors and Character Tags, But Nothing Else
  751.  
  752. It is acceptable to embed anchors within another HTML element: 
  753.  
  754.     <H1><A HREF = "Destination.html">My heading</A></H1>
  755.  
  756. Do not embed a heading or another HTML element within an anchor: 
  757.  
  758.     <A HREF = "Destination.html">
  759.     <H1>My heading</H1>
  760.     </A>
  761.  
  762. Although most browsers currently handle this example, it is forbidden by the
  763. official HTML and HTML+ specifications, and will not work with future browsers. 
  764.  
  765. Character tags modify the appearance of other tags: 
  766.  
  767.     <UL><LI><B>A bold list item</B>
  768.         <UL>
  769.         <LI><I>An italic list item</I>
  770.     </UL>
  771.  
  772. However, avoid embedding other types of HTML element tags. For example, it is
  773. tempting to embed a heading within a list, in order to make the font size
  774. larger: 
  775.  
  776.     <UL><LI><H1>A large heading</H1>
  777.         <UL>
  778.         <LI><H2>Something slightly smaller</H2>
  779.     </UL>
  780.  
  781. Although some browsers, such as NCSA Mosaic for the X Window System, format this
  782. construct quite nicely, it is unpredictable (because it is undefined) what other
  783. browsers will do. For compatibility with all browsers, avoid these kinds of
  784. constructs. 
  785.  
  786. What's the difference between embedding a <B> within a <LI> tag as opposed to
  787. embedding a <H1> within a <LI>? This is again a question of SGML. The semantic
  788. meaning of <H1> is that it's the main heading of a document and that it should
  789. be followed by the content of the document.Thus it doesn't make sense to find a 
  790. <H1> within a list. 
  791.  
  792. Character formatting tags also are generally not additive. You might expect that
  793.  
  794.     <B><I>some text</I></B>
  795.  
  796. would produce bold-italic text. On some browsers it does; other browsers
  797. interpret only the innermost tag (here, the italics). 
  798.  
  799. Check Your Links
  800.  
  801. When an <IMG> tag points at an image that does not exist, a dummy image is
  802. substituted. When this happens, make sure that the referenced image does in fact
  803. exist, that the hyperlink has the correct information in the URL, and that the
  804. file permission is set appropriately (world-readable). 
  805.  
  806. A Longer Example
  807.  
  808. Here is a longer example of an HTML document: 
  809.  
  810.     <HEAD>
  811.     <TITLE>A Longer Example</TITLE>
  812.     </HEAD>
  813.     <BODY>
  814.     <H1>A Longer Example</H1>
  815.     This is a simple HTML document. This is the first
  816.     paragraph. <P>
  817.     This is the second paragraph, which shows special effects.  This is a 
  818.     word in <I>italics</I>.  This is a word in <B>bold</B>.
  819.     Here is an in-lined GIF image: <IMG SRC = "myimage.gif">. 
  820.     <P>
  821.     This is the third paragraph, which demonstrates links.  Here is 
  822.     a hypertext link from the word <A HREF = "subdir/myfile.html">foo</A>
  823.     to a document called "subdir/myfile.html". (If you 
  824.     try to follow this link, you will get an error screen.) <P> 
  825.     <H2>A second-level header</H2>
  826.     Here is a section of text that should display as a 
  827.     fixed-width font: <P>
  828.     <PRE>
  829.         On the stiff twig up there
  830.         Hunches a wet black rook
  831.         Arranging and rearranging its feathers in the rain ...
  832.     </PRE>
  833.     This is a unordered list with two items: <P>
  834.     <UL>
  835.     <LI> cranberries
  836.     <LI> blueberries
  837.     </UL>
  838.     This is the end of my example document. <P>
  839.     <ADDRESS>Me (me@mycomputer.univ.edu)</ADDRESS>
  840.     </BODY>
  841.  
  842. Click here to see the formatted version. 
  843.  
  844. In addition to tags already discussed, this example also uses the <HEAD> ...
  845. </HEAD> and <BODY> ... </BODY> tags, which separate the document into
  846. introductory information about the document and the main text of the document.
  847. These tags don't change the appearance of the formatted document at all, but are
  848. useful for several purposes (for example, NCSA Mosaic for Macintosh 2.0, for
  849. example, allows you to browse just the header portion of document before
  850. deciding whether to download the rest), and it is recommended that you use these
  851. tags. 
  852.  
  853. For More Information
  854.  
  855. This guide is only an introduction to HTML and not a comprehensive reference.
  856. Below are additional sources of information. 
  857.  
  858. Fill-out Forms
  859.  
  860. One major feature not discussed here is fill-out forms, which allows users to
  861. return information to the World Wide Web server. For information on fill-out
  862. forms, look at this Fill-out Forms Overview 
  863.  
  864. Style Guides
  865.  
  866. The following offer advice on how to write ``good'' HTML: 
  867.  
  868.    Composing Good HTML 
  869.    CERN's style guide for online hypert 
  870.  
  871. Other Introductory Documents
  872.  
  873. These cover similar information as this guide: 
  874.  
  875.    How to Write HTML Files 
  876.    Introduction to HTML 
  877.  
  878. Additional References
  879.  
  880.    The HTML Quick Reference Guide, which provides a comprehensive listing of
  881.    HTML codes 
  882.    The official HTML specification 
  883.    A description of SGML, the Standard Generalized Markup Language 
  884.    Dan Connolly's HTML Design Notebook. Dan Connolly is one of the originators
  885.    of HTML. 
  886.  
  887.  
  888. National Center for Supercomputing Applications / pubs@ncsa.uiuc.edu 
  889.