HTML elements in action <h1>

Table of contents

This document

This document lists HTML elements, and for each, explains its purpose, lists its options (attributes and contents), gives its relationships with other elements, and, for some elements, shows how its simple use is rendered. The purpose of this document is to help learn HTML and create HTML documents. Information on HTML syntax is not in this document.

This document describes XHTML 1.1 (a W3C Recommendation 31 May 2001), and the Strict subsets of HTML 4.01 (a W3C Recommendation 24 December 1999) and XHTML 1.0 (a W3C Recommendation 26 January 2000). There are only slight differences from one to the next. HTML 4.01 is probably W3C's final non-XML specification. XHTML 1.0 is HTML 4.01 with rules that limit the syntax to conform to XML. XHTML 1.1 is XHTML 1.0 Strict but the elements are seperated into modules according to function. References in this document to section numbers in W3C's HTML 4.01 specification are in {curly brackets} or like this.

The HTML that structures this document is complient with all three specifications, except: (1) The first line's XML tag, and the slash in empty tags, are not complient with HTML. (2) Each specification requires a different DOCTYPE. (3) The HTML tag attributes in XHTML differ from those in HTML.

This document is incomplete, and a work in progress. For example, HTML elements are shown within [square brackets] because they're easier to type than <angle brackets>.

Inline-level elements are specified as such; others elements are block-level, except INS and DEL.

For each element, listed are the following:

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}

[ol] (ordered list) {10.2}

  1. [li] Item X (LI may contain flow elements only)
  2. [li] Item Y
  3. [li] Item Z

[ul] (unordered list) {10.2}

[dl] (definition list) {10.3}

[dt] term 1 (Contents: inline elements)
[dt] term 2
[dd] definition 1 (Contents: flow elements)
[dd] definition 2

Tables (Tables and Basic Tables Modules) {11}

The TABLE element (block) {11.2.1}

Table Captions: The CAPTION element {11.2.2}

Cell content alignment attributes {11.3.2}

For all table elements except TABLE and CAPTION (COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR).

Horizontal and verticle alignment (Basic Table Module)
align = left|center|right|justify|char (Horizontal)
valign = top|middle|bottom|baseline (Vertical)
If align="char": (not in Basic Table Module)
char = character on which to align (default: decimal point)
charoff = offset to the alignment character

Column groups: the COLGROUP and COL elements {11.2.4} (not in Basic Tables Module)

span = number (of columns)
width = multi-length
Contents COL elements (only in COLGROUP, and only if no span specified)

Row groups: the THEAD, TFOOT, and TBODY elements {11.2.3} (not in Basic Tables Module)

Contents: TR elements

Table rows: The TR element {11.2.5}

Contents: TH and TD elements

Table cells: The TH and TD elements {11.2.6}

headers = idrefs (TD) specifies header cells for this data cell
scope = row|col|rowgroup|colgroup (TH) cell is for remaining ...
abbr = text
axis = cdata
rowspan = number (of cells)
colspan = number (of cells)
Contents flow elements

Sample table

Caption: table elements and attributes
[th abbr=E] Element [th] Attribute name [th] Attribute values
[th] [td] [td]
[th] [td] [td]

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)

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}

Sample form containing six fieldsets

Text input fields (each within a label element)
Check box and button, (each within a label element)
File name
Buttons using INPUT element
Buttons using BUTTON element
Option lists (each within a label element)

Scripts {18} (Scripting Module)

The SCRIPT element {18.2.1} (an inline element)

The NOSCRIPT block element {18.3.1}

Element relationships

Elements that can be in more than element type

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

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 January 15, 2002.