Quickie Reference for HTML tags

TITLES AND HEADERS       OTHER FONT CONTROL       FORMATTING       IMAGES       LINKS       LISTS       TABLES       SPECIAL CHARACTERS


Web browers are case-insensitive to all HTML tags, so you may use <B>upper case</B> or <b>lower case</b> inside the tags as you prefer. However, file names (for hyperlinks and images) are case-sensitive, and must appear in quotation marks.

NOTE: The background color of a Web page is set in the <BODY> tag using the option BGCOLOR="#FFFFFF" (replacing FFFFFF with the appropriate 6-hex-digit code for the color you want).


(return to top)
TITLES AND HEADERS:

<title>Quickie Reference for HTML tags</title>
(title only appears once, at top of file)

<h1> Largest Header </h1>

<h2> 2nd-Largest Header </h2>

<h3> 3rd-rank Header </h3>

<h4> 4th-rank Header </h4>

<h5> 5th-rank Header </h5>
<h6> 6th-rank Header </h6>


(return to top)
OTHER FONT CONTROL:

Normal font,
<b>bold font</b>,
<i>italicized font</i>,
<tt>typewriter font</tt>.

Font sizes: the user of Netscape (or other browser) controls the absolute font sizes (using the ``Options'' pull-down menu, choosing General Preferences), but the Web-page editor can specify relative font sizes analogous to how different size headers are specified.

<font size="1">size="1",</font>
<font size="2">size="2",</font>
<font size="3">size="3",</font>
<font size="4">size="4",</font>
<font size="5">size="5",</font>
<font size="6">size="6",</font>

<font size="-2">size="-2",</font>
<font size="-1">size="-1",</font>
``Normal'' font size,
<font size="+1">size="+1",</font>
<font size="+2">size="+2",</font>


(return to top)
FORMATTING:

<pre>
Preformatted text    appears just
as    typed into the
		HTML file, in typewriter font ---

including vertical and horizontal blanks
</pre>
Otherwise, Netscape does its own formatting of text; shrinking multiple blanks (vertical & horizontal) to a single inter-word space, breaking lines to fit the actual size of the Netscape window (change your window size and see how text gets reformatted!!). However, Netscape grants some control to the editor of the page, who can use any of several control tags. For instance, the page author can force a new paragraph with the tag <p>

One can break a line <br>
without inserting a blank line for a separate paragraph.

<center> Left-right centering is often nice ! </center>

The special character     &nbsp;     (non-breaking space) forces an extra       horizontal       space;
use several of them consecutively for                 more horizontal space.

<blockquote> A paragraph can be set off as a quotation, getting indentation on both left and right sides, by enclosing it in a pair of ``blockquote'' tags. To be quoted, or not to be quoted, that is the question... </blockquote>

Superscripts, like

8m2     ---     8<i>m</i><sup>2</sup>
footnote17     ---     footnote<sup>17</sup>

Subscripts, like

H2O     ---     H<sub>2</sub>O
log10 x     ---     log<sub>10</sub> <i>x</i>


(return to top)
IMAGES:

Place an image on the page by inserting an ``image'' tag, with the name of the file of the image (usually a GIF or JPG file), in the appropriate place in the HTML Web file;

<img src="filename.gif">

Between the img and the src can come any of several options;

Colo Flag Here we demonstrate how a (small) GIF image, stored in file ``cflag.gif'', is inserted into this page. The full tag is
<img width=44 height=27 ALT="Colo Flag" align=left src="cflag.gif">

Alternate text It is considerate to include the ALT option for those browsers which cannot display, or have trouble loading, the image. (Try disabling "Auto Load Images" on your browser, or use the browser ``lynx''.) The full tag for the nonexistent image at right is
<img ALT="Alternate text" align=right src="alt.gif">


(return to top)
LINKS:

Links are the functional heart of the Web. The words which appear underlined and in color are the LINK TEXT. When the Netscape user clicks on these words then you want a new page to appear; the address of the new page is the ANCHOR.

<a href="anchor.html">LINK TEXT</a>

Everything between the <a href<> and </a<> tags is part of the link ``text'', even if it is an image, or includes an image. In the following hyperlink you can click on either the image or the words. (The color border of the image can be eliminated using the border=0 option in the img tag.)

<a href="anchor.html"> <img align=MIDDLE src="cflag.gif"> LINK TEXT </a>


(return to top)
LISTS:

Unordered list
  • an item
  • another item
  • and yet another item
<ul>
  <li>an item
  <li>another item
  <li>and yet another item
</ul>

Ordered list
  1. an item
  2. another item
  3. and yet another item
<ol>
  <li>an item
  <li>another item
  <li>and yet another item
</ol>

Definition list
This is a term
and this is its definition
This is another term
and this is its definition
And yet another term
and its definition
<dl>
  <dt> This is a term
    <dd> and this is its definition
  <dt> This is another term
    <dd> and this is its definition
  <dt> And yet another term
    <dd> and its definition
</dl>


(return to top)
TABLES:

  • For lotsa details see the ITS HTML Tables Tutorial Page
  • Tables often look best centered, so remember the <center> and </center> tags.
  • The table as a whole is surrounded by the pair <table> and </table>
  • Each row of the table is surrounded by the pair <tr> and </tr>
  • Each cell of the table is surrounded by the pair <td> and </td> (normal text, left-aligned) or by the pair <th> and </th> (bold text, centered)

    Animal Attribute
    DogLoyal
    CatSmart but lazy
    Tyrannosaurus RexHungry!
        <table border=5 cellpadding=8>
    <tr>
      <th>Animal</th>
      <th>Attribute</th>
    </tr>
    <tr>
      <td>Dog</td>
      <td>Loyal</td>
    </tr>
    <tr>
      <td>Cat</td>
      <th>Smart but lazy</th>
    </tr>
    <tr>
      <td>Tyrannosaurus Rex</td>
      <th><i>Hungry!</i></th>
    </tr>
    </table>

  • The option border=5 in the example sets the width of the outer raised border.
  • Using border=10 makes an even heavier border.
  • Using border=0 eliminates the visible border as well as the lines between cells; sometimes a nice effect!
  • The option cellpadding=8 in the example sets the amount of blank space (in pixels) surrounding the contents of each cell.
  • Using cellpadding=0 makes a very tight table, while using cellpadding=25 would spread the contents a lot, making things easier to read.
  • More complicated tables are possible...