HTML and XHTML reference outline

Table of contents

This document and HTML

Document purpose

This document's purpose is to help learn HTML and create HTML documents. This document lists HTML elements, and for each gives its:

HTML versions

This document describes the Strict subsets of the following HTML versions. There are only slight differences among the three.

HTML element syntax and notation

When coding HTML, each element contains: (ex., <name attribute="value"> content </name>)

  1. A start tag, usually required, within angle brackets, consisting of:
    1. Element name
    2. Attributes, usually optional, after the element name
      • Required
      • Optional
  2. Contents, if allowed, after the start tag
  3. An end tag, if contents allowed, consisting of a slash and the element name, within angle brackets

Case (upper or lower) sensitivity

Case Attribute values Examples
ignored defined by HTML spec content-type, media-descriptors
undefined outside the HTML spec script, uri
as is for human reading text (title, alt, standby, label)
sensitive reference elements (id, class)
not applicable are not alphabetic length (width, height)

Major parts of an HTML or XHTML document {7} (Structure Module)

At the beginning of each file containing HTML is the !DOCTYPE {7.2} specifying the markup language and its version. Second is the the HTML element {7.3} which contains everything else.

HTML element

The document head {7.4} - the HEAD element

The document body {7.5} - the BODY element

Attributes for BODY element, and for elements in it

Does not apply to SCRIPT, PARAM, BR, and IFRAME elements unless specified.

Main structural elements of the document body {7.5} <h2>

These elements' contents may contain text to render.

Grouping elements: the DIV (block) and SPAN (inline) elements {7.5.4}

[div] generic/grouping block container element (Contents: flow elements) [span] generic/grouping inline container element (Contents: inline elements)

Headings {7.5.5} [h3] (Contents: inline elements)

[h4] Heading 4 - fourth most important

[h5] Heading 5
[h6] Heading 6 - least important

Adding structure to forms: FIELDSET element {17.10}

Text {9} (Text Module)

Inline text elements that contain inline elements

Block text elements

[blockquote cite=url] Long quotation {9.2.2} (Contents: block and SCRIPT elements)

[pre xml:space="preserve"] preformatted text {9.3.4}
 Contents: inline elements but no font size changes nor IMG and OBJECT elements

[p] Paragraph (contents: inline elements) {9.3.1}
[br]
[br] Line break (an inline element) {9.3.2}

Marking document changes {9.4} (Edit Module)

Lists: ordered, unordered, and definition lists (flow elements) {10}

Tables {11}

These are in the Basic Tables Module unless specified otherwise, in which case, they are in the Tables Module. See a table in XHTML simple examples.

Cell content alignment attributes {11.3.2}

These four attributes are available for all table elements except TABLE and CAPTION (COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR).

Attributes

The A element {12.2} (Hypertext Module) (inline)

Image maps {13.6}, client-side: MAP element (Client-side Image Map Module) (inline)

Objects (images, applets) {13} (inline)

Including an image: the IMG element {13.2} (Image Module)

Generic inclusion (image, applet, HTML): the OBJECT element {13.3} (Object Module)

Inline frames: the IFRAME element {16.5} (IFrame Module)

See also examples of importing text into an HTML document.

Rules: the HR (horizontal rule/line) element {15.3} (Presentation Module)


Forms {17} (Forms and Basic Forms Modules) (Block)

See a form in XHTML simple examples.

The FORM block element {17.3} (these attributes affect only submission, not appearence)

Attributes for all form controls (INPUT, BUTTON, SELECT, TEXTAREA) (inline)

Form control labels and values

Control type attribute values Display label Initial value Submit value
INPUT textual text, password, file LABEL element value attribute Final field contents
INPUT buttons submit, reset, image value or src attribute n/a value attribute
INPUT choices checkbox, radio LABEL element checked attribute value attribute, default "on"
INPUT hidden hidden n/a n/a value attribute
BUTTON submit, button, reset element contents n/a value attribute
TEXTAREA n/a LABEL element element contents Final field contents
SELECT OPTION n/a label attribute, or
element contents
selected attribute value attribute, or
element contents

When a form is submitted, each submitted control field has the form "name=value", where name is specified by the element's name attribute, and value is the submit value (field contents for text field controls, value attribute for all other controls). Only controls that W3C call "successful" are submitted, including named and selected/activated choice, option, and button controls.

The INPUT form-control element {17.4}

The BUTTON form-control element {17.5} (not Basic Forms Module)

The SELECT form-control element (a menu with OPTION element choices) {17.6}

The TEXTAREA form-control element {17.7}

The LABEL element {17.9}

Scripts {18} (Scripting Module)

The SCRIPT element {18.2.1} (an inline element)

The NOSCRIPT block element {18.3.1}

Element relationships with each other

In this document, above, inline-level elements are specified as such; others elements are block-level, except INS and DEL.

Elements that can be in more than one element type

These are called flow elements, and can be within DIV, INS, DEL, DD, LI, TH, TD, OBJECT, FIELDSET, and BUTTON elements, unless specified.

Elements that can be in only one element type (and what they may contain)

Elements Within
TITLE (#PCDATA), STYLE (#PCDATA),
BASE, META, and LINK
HEAD
LEGEND (inline) FIELDSET
DT (inline) and DD (flow) DL
CAPTION (inline), COLGROUP (COL), and
THEAD, TFOOT, and TBODY (TR)
COLGROUP
COL COLGROUP
TR (TH, TD) THEAD, TFOOT, and TBODY
TH and TD (flow) TR
PARAM OBJECT
AREA MAP
OPTGROUP (OPTION) SELECT
OPTION (#PCDATA) OPTGROUP
BODY (block, SCRIPT), HEAD HTML
LI (flow) UL, OL

ADDRESS element (contact information for a document) {7.5.6}

[address] Address elements contain only inline elements.
This page is copyright © 2001-2002 by David Cohen.
[web] [home] [about] [copyright] [contact] This page last changed April 18, 2002.