CS110 HTML Reference
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, used for
CSS, for URL fragments, and for accessing element using DOM.
- CLASS - specify a style sheet for this element and elts like it.
- NAME - similar to ID, but an older feature
- JavaScript events, such
as
onMouseOver, onMouseOut, onClick.
Top-level Elements
- HTML - HTML document
- HEAD - Document head
- BODY
- Document body. Can support an
onload event handler
Head Elements
- LINK
- Document relationship (to external style sheet). Attributes:
SRC="URL" REL="stylesheet"
- META -
Metadata, such as keywords, description, author, and so forth. Attributes:
NAME="type" CONTENT="value"
- SCRIPT -
Client-side script. Attributes: TYPE="text/JavaScript" also SRC="URL"
- 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 (a
rule
is a line across an element)
- P
- Paragraph. Closing tag is optional.
- PRE
- Preformatted text, usually in a
monospace typewriter font
Lists
- LI
- List item. Closing tag is optional.
- OL
- Ordered list, so items are numbered, lettered or whatever
- UL
- Unordered list, elements are given bullets of some sort
- DL - Definition list
- DT - Definition term
- DD - Definition description
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. But it's usually
better to use CSS.
- 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" Types
include
text
, hidden
, radio
, checkbox
,
and button
- LABEL
- Form field label. Attribute is FOR="idref"
- SELECT - Option selector
- OPTION
- Menu option. Attribute VALUE="form data"
- TEXTAREA -
Multi-line text input. Attributes: ROWS="number" COLS="number"
Inline Elements
- A -
Anchor or hyperlink. Attributes: href="url"
- BR - Line break
- IMG -
Inline image. Attributes: SRC="url" ALT="text"
- 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
- EM
- Emphasis, typically done in italics
- STRONG
- Strong emphasis, typically in a bold font weight
Character Entities
Non-ASCII characters can be included in the document by
using entities,
such as:
| Character |
Entity |
Decimal |
Hex |
Rendering in Your Browser |
| Entity |
Decimal |
Hex |
| no-break space = non-breaking space |
|
  |
  |
|
|
|
| inverted exclamation mark |
¡ |
¡ |
¡ |
¡ |
¡ |
¡ |
| cent sign |
¢ |
¢ |
¢ |
¢ |
¢ |
¢ |
| pound sign |
£ |
£ |
£ |
£ |
£ |
£ |
| copyright sign |
© |
© |
© |
© |
© |
© |
| registered sign = registered trade mark sign |
® |
® |
® |
® |
® |
® |
| degree sign |
° |
° |
° |
° |
° |
° |
| plus-minus sign = plus-or-minus sign |
± |
± |
± |
± |
± |
± |
| superscript two = superscript digit two = squared |
² |
² |
² |
² |
² |
² |
| superscript three = superscript digit three = cubed |
³ |
³ |
³ |
³ |
³ |
³ |
| micro sign |
µ |
µ |
µ |
µ |
µ |
µ |
| pilcrow sign = paragraph sign |
¶ |
¶ |
¶ |
¶ |
¶ |
¶ |
| vulgar fraction one half = fraction one half |
½ |
½ |
½ |
½ |
½ |
½ |
| inverted question mark = turned question mark |
¿ |
¿ |
¿ |
¿ |
¿ |
¿ |