HTML 4 Elements
This document is a condensed version of this HTML 4
reference. It is modified under the terms of the Open Publication
License, (the latest version is presently available at http://www.opencontent.org/openpub/).
This derivative work is copyrighted by Scott D. Anderson, and is
released under the Open Publication License. The changes are primarily
to condense it, omitting tags not covered in CS110, and putting in
typical attributes and values. Changes by Scott D. Anderson
Common Attributes
Essentially every tag supports the following common attributes:
- ID - specify a unique identity or label for this element
- NAME - used the same as ID, but an older feature
- JavaScript events, such as OnMouseOver, OnMouseOut, OnClick.
Top-level Elements
- HTML - HTML document
- HEAD - Document head
- BODY - Document body
Head Elements
- LINK - Document relationship
- META -
Metadata, such as keywords, description, author, and so forth. Attributes:
name="type" content="value"
- SCRIPT -
Client-side script. Attributes: type="text/JavaScript"
- STYLE -
Embedded style sheet. Attributes: type="text/css"
- TITLE - Document title
Generic Block-level Elements
- BLOCKQUOTE - Block quotation
- DIV - Generic block-level container
- H1 - H6 -
Levels of heading
- HR - Horizontal rule
- P - Paragraph
- PRE - Preformatted text
Lists
- DL - Definition list
- DT - Definition term
- DD - Definition description
- LI - List item
- OL - Ordered list
- UL - Unordered list
Tables
The following attributes apply to many of the tags below: CELLSPACING, CELLPADDING,
WIDTH, and HEIGHT. All values are a length (in pixels) or a percentage. Another
common attribute is BGCOLOR, whose value is a color.
- TABLE -
Table. Attributes: BORDER="length" SUMMARY="text"
- CAPTION -
Table caption, typically is centered above the table
- TR - Table row
- TD - Table data cell
- TH - Table header cell
Forms
- FORM -
Interactive form. Attributes: NAME="DOM identifier" METHOD="post"
ACTION="url of CGI script" OnSubmit="event
handler"
- BUTTON -
Button. Attributes: VALUE="text in the button" OnClick="JavaScript
code"
- INPUT -
Form input. Attributes: TYPE="kind of input" NAME="DOM
identifier" VALUE="form
data"
- LABEL - Form field label
- SELECT - Option selector
- TEXTAREA -
Multi-line text input. Attributes: rows="number" cols="number"
Special Inline Elements
- A -
Anchor or hyperlink. Attributes: href="url"
- BR - Line break
- IMG -
Inline image. Attributes: SRC="url" ALT="text"
USEMAP="url of map"
- MAP -
Image map. Attributes: name="identifier"
- AREA -
Image map region. Attributes: SHAPE="rect, poly or circ"
COORD="x,y pairs" HREF="url"
- Q - Short quotation
- SCRIPT -
Client-side script. Attributes same as when it's in the head
- SPAN - Generic inline container
- SUB - Subscript
- SUP - Superscript
Phrase Elements