An Algorithmic and Social Introduction to Computer Science (CSC-105 2000S)


SamR's Quick HTML Reference

Since I teach a variety of people about HTML, I find it appropriate to keep a simple reference to HTML handy, as much of the HTML documentation is either unwieldy or outdated. For example, the HTML 3.0 documentation runs over 190 pages, and many of the traditional HTML references available at the time that I first wrote this (ca. 1995) included deprecated elements, such as <menu>. These days, there are now good references, but I still find it convenient to have my own.

Unfortunately, the time pressures of academic life have not given me sufficient opportunity to flesh-out all of this document (e.g., HTML's relationship to SGML). Nonetheless, both my students and I find it of some use, particularly in the electronic form.

Introduction

HTML, the hypertext markup language is a common language for building hypertext documents for the World-Wide Web. Originally, authors had to build their documents in "raw HTML" because no tools were available. Now that such tools are available, many people no longer directly write HTML. Nonetheless, there a good reasons to learn HTML, particularly because it helps you understand what is and is not possible on the web.

More recently, other markup languages have been developed and extensions to HTML have been added. The extensions are often platform specific. The other languages are often standards and provide more facilities. One key successor to HTML is XML (extensible markup language). HTML has also been extended with CSS (cascading style sheets) to give page authors more control over appearance. Neither additional languages nor extensions are covered in this document.

Note that HTML is a markup language, not a programming language. What's the difference? A markup language indicates information about the structure or purpose of pieces of information; a programming language indicates information about the execution of a process (more or less).

HTML Tags

In HTML, as in most markup languages, a page author marks up the document, indicating the roles of various parts of the page. One might indicate that something is the title of the document, the beginning of a section, an item in a list, and so on and so forth.

In HTML, textual elements are traditionally surrounded by tags, although there are some tags that act as text elements. A piece of marked-up text looks something like

<TAG>some text</TAG>

Note that the TAG indicates something about the text. For example, the TAG might be P for ``paragraph'' or em for ``emphasized''.

For example, one might indicate the title of a document with

<title>SamR's Quick HTML Reference</title>

Attributes

In addition, certain tags may have attributes (additional characteristics). For example, in Netscape's version of HTML, items in a list may indicate the type of mark that accompanies the item. In such cases, a piece of marked-up text looks something like

<TAG ATTRIBUTE_NAME=ATTRIBUTE>some text</TAG>

For example, one might describe a table with a larger-than-normal border with

<table border=10> ... </table>

Logical and physical markup

Note that there are two basic kinds of markup: logical markup, in which one describes the roles of pieces of text (e.g., ``this is a section heading'') and physical markup, in which one describes the appearance of text (e.g., ``this is times, twelve point, bold, centered''). Logical markup supports better information retrieval and permits readers to select appearances they find most appropriate. HTML provides a mixture of logical and physical markup tags, with some bias towards logical markup. More recently, HTML has added style sheets, which provides both a way to define your own logical elements and a way to assign a physical appearance to each logical element.

Structure of HTML documents

Each HTML document is broken into two pieces:

As one might expect, the head is surrounded by <head> and </head> tags, and the body is surrounded by <body> and </body> tags. Netscape extends the body tag with a background attribute. I feel that this makes documents unreadable, but your mileage may vary.

In addition, the whole document should be surrounded by <html> and </html> tags.

A basic HTML document might therefore appear as follows:

<html>
<head>
<title>A basic HTML document</title>
</head>
<body>
<p>
This is the only line in the document.
</p>
</body>
</html>

Components of the head

There are a number of different things you can put in the head of the document. You'll find that many documents include only a title. For now, all that you really need to understand is the title tag.

Components of the body

Paragraphs in HTML

Section Headings

HTML uses a hierarchical heading system, with labels from <h1> to <h6> Much of the documentation suggests that you only use them in order. For example, you should always begin your documents with an h1 tag and you should never use an h3 tag without a surrounding h2 tag.

Text Styles

Graphic elements

Links and anchors

So far, the tags we've seen have described parts of almost any text, whether on the Web or in printed form. Now let us consider the things that make hypertext hypertext: the links from page to page, and the anchors that let us link to particular parts of a page.

Lists in HTML

Tables in HTML

While HTML tables were originally developed to support better presentation of tabular data (that is, data that you'd like to organize into columns and rows), tables are often used to provide more precise layout. When you write HTML for me, you should only use tables for presenting tabular data and not for layout.

Miscellaneous


Index of HTML Tags


History

Summer 1995

1995-1999

Monday, 25 August 1999

Wednesday, 1 September 1999

Tuesday, 25 January 2000


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS105/2000S/Handouts/html-quick.html

Source text last modified Tue Jan 25 08:34:50 2000.

This page generated on Tue Jan 25 08:39:29 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu