HTML Lesson One

Table of Contents

Basic Tags
Character Formatting
Adding Color
Comments


Disclaimer
Reference

Things to note:

HTML is NOT case sensitive. Therefore title and TITLE are equivalent to Title. Note there are a few exceptions.

Not all tags are supported by all WWW browsers. If a browser does not support a tag, it (usually) just ignores it.

Basic Tags

You use HTML tags to mark the elements of a file for you browser. These elements can combine plain text, other elements or both.

Tags are usually paired (e.g., <CENTER> and </CENTER>) to start and end the tag instruction. The end tags look like the start tag except a slash (/) precedes the text within the brackets.

HTML

This element tells your browser that the file contains HTML-coded information. The file extension .html also indicates this is an HTML document and must be used. (If you are restricted to 8.3 filenames (e.g., LeeHome.htm, use only .htm for your extension.)

HEAD

The head element identifies the first part of your HTML-coded document that contains the title.

TITLE

The title element contains your document title and identifies its content in a global context. The title is displayed somewhere on the browser window (usually at the top), but not within the text area.

BODY

The second--and largest--part of your HTML document is the body, which contains the content of your document.

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 element is:
<Hy>Text of heading </Hy> where y is a number between 1 and 6 specifying the level of the heading. Headings can also be aligned:

Left: <H3 ALIGN=LEFT >

Center:<H3 ALIGN=CENTER >

Right: <H3 ALIGN=RIGHT >

this is H1

this is H2

this is H3

this is H4

this is H5
this is H6

Paragraphs and Breaks

Unlike documents in most word processors, carriage returns in HTML files aren't significant. So you don't have to worry about how long your lines of text are Word wrapping can occur at any point in your source file, and multiple spaces are collapsed into a single space by your browser.

Similarly, Breaks can be use to force the end of a sentence and start a new one. The <BR> tag forces a line break with no extra (white) space between lines.

Using this code:
Produces this:
 <P> Welcome to the world of HTML.</P> 
 <P> This is the first paragraph.</P> 
 <P> While short it is</P>
 <P> still a paragraph!</P>

Welcome to the world to HTML.

This is the first paragraph.

While short it is

still a paragraph!

 <P> Welcome to the world of HTML. 
 <BR> This is the first paragraph. 
 <BR> While short it is
 <BR> still a paragraph!</P>

Welcome to the world of HTML.
This is the first paragraph.
While short it is
still a paragraph!

LISTS


HTML supports unnumbered, numbered, and definition lists. You can nest lists too, but use this feature sparingly because too many nested items can get difficult to follow.

Unnumbered Lists

To make an unnumbered, bulleted list,
  1. start with an opening list <UL> (for unnumbered list) tag
  2. enter the <LI> (list item) tag followed by the individual item; no closing </LI> tag is needed
  3. end the entire list with a closing list </UL> tag

Using this code: Produces this:
    <UL>
    <LI> apples
    <LI> bananas
    <LI> grapefruit
    </UL>
  • apples
  • bananas
  • grapefruit

Numbered Lists

A numbered list (also called an ordered list, from which the tag name derives) is identical to an unnumbered list, except it uses <OL> instead of <UL>. The items are tagged using the same <LI> tag.

Using this code: Produces this:
    <OL>
    <LI> oranges
    <LI> peaches
    <LI> grapes
    </OL>
  1. oranges
  2. peaches
  3. grapes

Definition Lists

A definition list (coded as <DL>) usually consists of alternating a definition term (coded as <DT>) and a definition definition (coded as <DD>). Web browsers generally format the definition on a new line.

Using this code: Produces this:
<DL>
<DT> NCSA
<DD> NCSA, the National Center for Supercomputing Applications, is located on the campus of the University of Illinois at Urbana-Champaign.
<DT> Cornell Theory Center
<DD> CTC is located on the campus of Cornell University in Ithaca, New York. </DL>
NCSA
NCSA, the National Center for Supercomputing Applications, is located on the campus of the University of Illinois at Urbana-Champaign.
Cornell Theory Center
CTC is located on the campus of Cornell University in Ithaca, New York.

Nested Lists

Lists can be nested. You can also have a number of paragraphs, each containing a nested list, in a single list item.

Using this code:
Produces this:
    <UL>
    <LI> A few New England states:
        <UL>
        <LI> Vermont
        <LI> New Hampshire
        <LI> Maine
        </UL>
    <LI> Two Midwestern states:
        <UL>
        <LI> Michigan
        <LI> Indiana
        </UL>
    </UL>
  • A few New England states:
    • Vermont
    • New Hampshire
    • Maine
  • Two Midwestern states:
    • Michigan
    • Indiana

Horizontal Rules:

The <HR> tag produces a horizontal line the width of the browser window. A horizontal rule is useful to separate sections of your document. For example, many people add a rule at the end of their text and before the <address> information.

You can vary a rules size (thickness) and width (the percentage of the window covered by the rule). Also you can use a horizontal rule with out the 3-D affect.Experiment with the settings until you are satisfied with the presentation.For example:

<HR SIZE=4 WIDTH="50%"> displays as:


and: <HR SIZE=20 WIDTH="80%"> displays as:


and: <HR NOSHADE SIZE=20 WIDTH="80%"> displays as:


Character Formatting

Use the following tags to change the style of text:

<B>
bold text (BOLD)
<TT>
typewriter text, (fixed-width font)
<I>
italic text (Italic)
The following can also be use for italic:
<DFN>
for a word being defined. Typically displayed in italics. (NCSA Mosaic is a World Wide Web browser.)
<EM>
for emphasis. Typically displayed in italics. (Consultants cannot reset your password unless you call the help line.)
<CITE>
for titles of books, films, etc. Typically displayed in italics. (A Beginner's Guide to HTML)
<VAR>
for a variable, where you will replace the variable with specific information. Typically displayed in italics. (rm filename deletes the file.)

<CODE>
for computer code. Displayed in a fixed-width font. (The <stdio.h> header file)
<KBD>
for user keyboard entry. Typically displayed in plain fixed-width font. (Enter passwd to change your password.)
<SAMP>
for a sequence of literal characters. Displayed in a fixed-width font. (Segmentation fault: Core dumped.)
<STRONG>
for strong emphasis. Typically displayed in bold. (NOTE: Always check your links.)
<BLINK>
usually annoying but used to get attention.

Preformatted Text

Use the <PRE> tag (which stands for "preformatted") to generate text in a fixed-width font. This tag also makes spaces, new lines, and tabs significant (multiple spaces are displayed as multiple spaces, and lines break in the same locations as in the source HTML file). This is useful for program listings, among other things. This is very similar to <code> but very helpful when writing multiple lines.

Using this code:
Produces this:
<PRE>
  for (i=0; i<5; i++)
   {
     y=y+Prices[i];
   }
   y=y/5;
   y.WriteFract();
</PRE>
 for (i=0; i<5; i++)
  {
    y=y+Prices[i];
  }
  y=y/5;
  y.WriteFract();

Special Characters

There are two ways to use "special" characters in HTML. Character referencing and numeric referencing. Using the HTML format   &#XXX;     and this table, these characters can be displayed. These tables were taken from: Gerald J. Brindle (gjb@efn.org) and Michael J. Hannah Sandia National Laboratories The actual pages is listed in the reference section.

DECIMAL ASCII for HTML
006 ----007 ---- 008 ----009 -- -- 010 -- --011 -- --
012 -- --013 -- -- 014 ----015 ---- 016 ----017 ----
018 ----019 ---- 020 ----021 ---- 022 ----023 ----
024 ----025 ---- 026 ----027 ---- 028 ----029 ----
030 ----031 ---- 032 -- --033 --!-- 034 --"--035 --#--
036 --$--037 --%-- 038 --&--039 --'-- 040 --(--041 --)--
042 --*--043 --+-- 044 --,--045 ----- 046 --.--047 --/--
048 --0--049 --1-- 050 --2--051 --3-- 052 --4--053 --5--
054 --6--055 --7-- 056 --8--057 --9-- 058 --:--059 --;--
060 --<--061 --=-- 062 -->--063 --?-- 064 --@--065 --A--
066 --B--067 --C-- 068 --D--069 --E-- 070 --F--071 --G--
072 --H--073 --I-- 074 --J--075 --K-- 076 --L--077 --M--
078 --N--079 --O-- 080 --P--081 --Q-- 082 --R--083 --S--
084 --T--085 --U-- 086 --V--087 --W-- 088 --X--089 --Y--
090 --Z--091 --[-- 092 --\--093 --]-- 094 --^--095 --_--
096 --`--097 --a-- 098 --b--099 --c-- 100 --d--101 --e--
102 --f--103 --g-- 104 --h--105 --i-- 106 --j--107 --k--
108 --l--109 --m-- 110 --n--111 --o-- 112 --p--113 --q--
114 --r--115 --s-- 116 --t--117 --u-- 118 --v--119 --w--
120 --x--121 --y-- 122 --z--123 --{-- 124 --|--125 --}--
126 --~--127 ---- 128 --€--129 ---- 130 --‚--131 --ƒ--
132 --„--133 --…-- 134 --†--135 --‡-- 136 --ˆ--137 --‰--
138 --Š--139 --‹-- 140 --Œ--141 ---- 142 --Ž--143 ----
144 ----145 --‘-- 146 --’--147 --“-- 148 --”--149 --•--
150 --–--151 --—-- 152 --˜--153 --™-- 154 --š--155 --›--
156 --œ--157 ---- 158 --ž--159 --Ÿ-- 160 -- --161 --¡--
162 --¢--163 --£-- 164 --¤--165 --¥-- 166 --¦--167 --§--
168 --¨--169 --©-- 170 --ª--171 --«-- 172 --¬--173 --­--
174 --®--175 --¯-- 176 --°--177 --±-- 178 --²--179 --³--
180 --´--181 --µ-- 182 --¶--183 --·-- 184 --¸--185 --¹--
186 --º--187 --»-- 188 --¼--189 --½-- 190 --¾--191 --¿--
192 --À--193 --Á-- 194 --Â--195 --Ã-- 196 --Ä--197 --Å--
198 --Æ--199 --Ç-- 200 --È--201 --É-- 202 --Ê--203 --Ë--
204 --Ì--205 --Í-- 206 --Î--207 --Ï-- 208 --Ð--209 --Ñ--
210 --Ò--211 --Ó-- 212 --Ô--213 --Õ-- 214 --Ö--215 --×--
216 --Ø--217 --Ù-- 218 --Ú--219 --Û-- 220 --Ü--221 --Ý--
222 --Þ--223 --ß-- 224 --à--225 --á-- 226 --â--227 --ã--
228 --ä--229 --å-- 230 --æ--231 --ç-- 232 --è--233 --é--
234 --ê--235 --ë-- 236 --ì--237 --í-- 238 --î--239 --ï--
240 --ð--241 --ñ-- 242 --ò--243 --ó-- 244 --ô--245 --õ--
246 --ö--247 --÷-- 248 --ø--249 --ù-- 250 --ú--251 --û--
252 --ü--253 --ý-- 254 --þ--255 --ÿ-- 256 --Ā-- gjb --&#gjb;--
Minimum Attributes
The leading ampersand is required. The ampersand and semicolon delimit an entity name which the user agent will replace with a special character. The trailing semicolon is necessary when the character following the entity is not a space or end of line. It is never incorrect to include the trailing semicolon.
Typical Characters
&lt;
< (less than sign)
&gt;
> (greater than sign)
&amp;
& (The ampersand sign itself)
&quot;
" (quote character)
Alphabetic Characters with Diacritical Marks
&AElig;
Æ (capital AE diphthong (ligature))
&Aacute;
Á (capital A, acute accent)
&Acirc;
 (capital A, circumflex accent)
&Agrave;
À (capital A, grave accent)
&Aring;
Å (capital A, ring)
&Atilde;
à (capital A, tilde)
&Auml;
Ä (capital A, dieresis or umlaut)
&Ccedil;
Ç (capital C, cedilla)
&ETH;
Ð (capital Eth, Icelandic)
&Eacute;
É (capital E, acute accent)
&Ecirc;
Ê (capital E, circumflex accent)
&Egrave;
È (capital E, grave accent)
&Euml;
Ë (capital E, dieresis or umlaut)
&Iacute;
Í (capital I, acute accent)
&Icirc;
Î (capital I, circumflex accent)
&Igrave;
Ì (capital I, grave accent)
&Iuml;
Ï (capital I, dieresis or umlaut)
&Ntilde;
Ñ (capital N, tilde)
&Oacute;
Ó (capital O, acute accent)
&Ocirc;
Ô (capital O, circumflex accent)
&Ograve;
Ò (capital O, grave accent)
&Oslash;
Ø (capital O, slash)
&Otilde;
Õ (capital O, tilde)
&Ouml;
Ö (capital O, dieresis or umlaut)
&THORN;
Þ (capital THORN, Icelandic)
&Uacute;
Ú (capital U, acute accent)
&Ucirc;
Û (capital U, circumflex accent)
&Ugrave;
Ù (capital U, grave accent)
&Uuml;
Ü (capital U, dieresis or umlaut)
&Yacute;
Ý (capital Y, acute accent)
&aacute;
á (small a, acute accent)
&acirc;
â (small a, circumflex accent)
&aelig;
æ (small ae diphthong (ligature))
&agrave;
à (small a, grave accent)
&aring;
å (small a, ring)
&atilde;
ã (small a, tilde)
&auml;
ä (small a, dieresis or umlaut mark)
&ccedil;
ç (small c, cedilla)
&eacute;
é (small e, acute accent)
&ecirc;
ê (small e, circumflex accent)
&egrave;
è (small e, grave accent)
&eth;
ð (small eth, Icelandic)
&euml;
ë (small e, dieresis or umlaut mark)
&iacute;
í (small i, acute accent)
&icirc;
î (small i, circumflex accent)
&igrave;
ì (small i, grave accent)
&iuml;
ï (small i, dieresis or umlaut mark)
&ntilde;
ñ (small n, tilde)
&oacute;
ó (small o, acute accent)
&ocirc;
ô (small o, circumflex accent)
&ograve;
ò (small o, grave accent)
&oslash;
ø (small o, slash)
&otilde;
õ (small o, tilde)
&ouml;
ö (small o, dieresis or umlaut mark)
&szlig;
ß (small sharp s, German (sz ligature))
&thorn;
þ (small thorn, Icelandic)
&uacute;
ú (small u, acute accent)
&ucirc;
û (small u, circumflex accent)
&ugrave;
ù (small u, grave accent)
&uuml;
ü (small u, dieresis or umlaut mark)
&yacute;
ý (small y, acute accent)
&yuml;
ÿ (small y, dieresis or umlaut mark)
Other Special Characters
&acute;
´ (Acute accent)
&brvbar;
¦ (Broken vertical bar)
&cedil;
¸ (Cedilla)
&cent;
¢ (Cent sign)
&copy;
© (A copyright symbol)
&curren;
¤ (General currency sign)
&deg;
° (Degree sign)
&divide;
÷ (Division sign)
&frac12;
½ (Fraction one-half)
&frac14;
¼ (Fraction one-fourth)
&frac34;
¾ (Fraction three-fourths)
&iexcl;
¡ (Inverted exclamation)
&iquest;
¿ (Inverted question mark)
&laquo;
« ILeft angle quote, guillemotleft)
&macr;
¯ (Macron accent)
&micro;
µ (Micro sign)
&middot;
· (Middle dot)
&nbsp;
  (A non-breaking space)
&not;
¬ (Not sign)
&ordf;
ª (Feminine ordinal)
&ordm;
º (Masculine ordinal)
&para;
¶ (Paragraph sign)
&plusmn;
± (Plus or minus)
&pound;
£ (Pound sterling)
&raquo;
» (Right angle quote, guillemotright)
&reg;
® (A registered trademark symbol)
&sect;
§ (Section sign)
&shy;
­ (A soft hyphen)
&sup1;
¹ (Superscript one)
&sup2;
² (Superscript two)
&sup3;
³ (Superscript three)
&times;
× (Multiply sign)
&uml;
¨ (Umlaut - dieresis)
&yen;
¥ (Yen sign)

Fonts

If the text items below appear in different fonts, then your browser supports the <font FACE=XXXX>...</font> tag. If only some of the fonts are different, it may just be that your computer does not have the specified font.

Adding color

There are 5 different aspect of a web page who's color you can control. They are the background, the regular text, the unvisited links, the currently active link and visited links. Of these, the currently active link is least likely to be used. Even with a slow dial-up modem I rare see the links change colors.

The HTML coding is fairly simple. For the background color use this:
<body bgcolor="#FFFFFF">
This produces a page with a white background because the color code #FFFFFF is the code for white.
To change the text color, use the follow:
<body text="#000000">
This produces a page with black text because the color code #000000 is the code for black.
To change the unvisited links color, use the follow:
<body link="#00FF00">
This produces a page with blue links because the color code #00FF00 is the code for blue.
To change the active link color, use the follow:
<body alink="#DB70DB">
This produces a page with purple links while the link is active because the color code #DB70DB is the code for purple.
      To change the active link color, use the follow:
<body vlink="#FF0000">
This produces a page with red visted links because the color code #FF0000 is the code for red.

The color code are made up of 3 2-digit codes with each 2 digit code representing the amount of red, blue or green that makes up the color. The digits are not base 10 numbers which make them look strange to most people. They are actually hexadecimal or base 16. So 10 in hexadecimal is 16 in base 10. A color that starts with 00 has no red and a color that ends in 00 has no blue. A color that starts with FF has full red and a color with FF as its middle pair of digits has full green.

Your choices of numbers and letters to combine include:0,1,2,3,4,5,6,7,8,9,a,b, c,d,e,f. They can be used in any combination. Here are just a few examples:

Red#FF0000 White#FFFFFF Blue #0000FF Green#00FF00
Yellow#FFFF00 Black#000000 Grey#C0C0C0 Neon Pink#FF6EC7
Cyan#00FFFF Purple#660099 Pink #FFCCFF Sky Blue#99CCFF

To change the color of a specific word (like I have done above) use the <font> tags along with color, Like this:


   This would be plain color text,
   But<font color="#ff0000">THIS</font>
   is not

This would be plain color text, But THIS is not

Not every browser displays color the same way. For example, Netscape on Macintosh and Windows will sometimes dither color that make up the background. The dithering pattern makes text difficult to read. A solution is create with a graphics program a small square image filled with the color that you want for your background. Then use Netscape's background command within the body like so:
<body background="red.gif">


Comments

The definition of an HTML comment is basically as follows:

A comment declaration starts with <!, followed by zero or more comments, followed by >. A comment starts and ends with "--", and does not contain any occurrence of "--".
This means that the following are all legal comments:
  1. <!-- Hello -->
  2. <!-- Hello -- -- Hello-->
  3. <!---->
  4. <!------ Hello -->
  5. <!>
Note that an "empty" comment tag, with just "--" characters, should always have a multiple of four "-" characters to be legal. (And yes, <!> is also a legal comment - it's the empty comment).

Not all HTML parsers get this right. For example, "<!------> hello-->" is a legal comment, as you can verify with the rule above. It is a comment tag with two comments; the first is empty and the second one contains "> hello". If you try it in a browser, you will find that the text is displayed on screen.

There are two possible reasons for this:

  1. The browser sees the ">" character and thinks the comment ends there.
  2. The browser sees the "-->" text and thinks the comment ends there.
There is also the problem with the "--" sequence. Some people have a habit of using things like "<!-------------->" as separators in their source. Unfortunately, in most cases, the number of "-" characters is not a multiple of four. This means that a browser who tries to get it right will actually get it wrong here and actually hide the rest of the document.

For this reason, use the following simple rule to compose valid and accepted comments:

An HTML comment begins with "<!--", ends with "-->" and does not contain "--" or ">" anywhere in the comment.

Lesson Two


Disclaimer

This document contains many parts of many different documents obtained from the WWW. I have attempted to recognize each one in my Reference list.

REFERENCE

Useful sites and documents that I have used:

CS at Buffalo's list of HTML reference sites

How to do imagemapsNCSU's help with Image Maps
Professional Web Design Great Tutorials for frames, tables, and forms.
Introduction To HTML and URLs By Ian Graham
Color Center A page that lets you "make" your own color.
RGBHEX Triplet Color Chart Lists all possiable color combinations
HTML Bad Style Page A collection of DONTs for HTML
Wilbur - HTML 3.2 Sorry this link is not currently active....(4/29/97)
Another example of bad styleA New Level of HTML-Abuse
T H E B A R E B O N E S G U I D E T O H T M L by Kevin Werbach
HTML tutorial Writing HTML: The Lessons Maricopa Center for Learning and Instruction (MCLI)
HTML Reference Manual by Michael J. Hannah Sandia National Laboratories
David W. Baker's WWW Authoring Information A great place for info and links
"A Beginner's Guide to HTML"Easy to follow HTML source site
NCSA Mosaic(tm) Tables Tutorial This link is also not active....(4/29/97)
HTML Groups, Discussion Forums, and Archives
sites Lots of links and other helpful sites
Introduction to HTML A good introduction to HTML authoring
Intermediate HTML A sequel with more advanced lessons.
Hypertext Markup Language - 2.0 (RFC 1866)The HTML standard.
HTML Quick Reference A good cheat sheet.
World Wide Web FAQCheck here for questions on all things Web.
A Guide to URLs A comprehensive guide to Web locators... That is not active... (4/29/97)
Special Characters

Table of Contents