home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeWeb Design in a NutshellSearch this book

Appendix B. List of Attributes

Most HTML tags rely on attributes to modify their behavior and make them more useful. With so many available tags and attributes, it's easy to forget which tag goes with which attributes. For instance, you may know that you want to set the padding value for a table, but you can't remember which tag takes the cellpadding attribute (the answer to this one is <table>).

The following table provides an alphabetical list of all attributes as listed in the HTML 4.01 specification. The "Related Elements" column provides a list of tags that can use that attribute. The table also lists:

  • Accepted values for each tag

  • Whether the attribute is required

  • A description of the attribute's use

  • Whether the attribute has been deprecated (indicated by a D in the "Depr." column)

Note that some attributes appear more than once in the list. This is due to the fact that they may be used differently or may take different values depending on the tag in which they are used.

Name

Related elements

Values

Depr.

Comment

abbr

TD, TH

text

 

Abbreviated name for table cell

accept-charset

FORM

list

 

List of supported character sets

accept

INPUT, FORM

MIME types

 

List of MIME types for file upload

accesskey

A, AREA, BUTTON, INPUT, LABEL, LEGEND, TEXTAREA

single character

 

Assigns a shortcut key that brings focus to (activates) the element

action(required)

FORM

URL

 

Location of the CGI form processor on the server

align

CAPTION

top|bottom|left|right

D

Positions caption relative to table

align

APPLET, IFRAME, IMG, INPUT, OBJECT

top|middle|bottom|left|right

D

Vertical or horizontal alignment

align

LEGEND

top|bottom|left|right

D

Positions legend relative to fieldset

align

TABLE

left|center|right

D

Table position relative to window

align

HR

left|center|right

D

Horizontal alignment of rule

align

DIV, H1, H2, H3, H4, H5, H6, P

left|center|right|justify

D

Alignment or justification of block element

align

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

left|center|right|justify|char

 

Horizontal alignment, character alignment, or justification

alink

BODY

color

D

Color of active (selected) links

alt

APPLET

text

D

Alternative text if the applet cannot be displayed

alt(required)

AREA, IMG

text

 

Alternative text that describes image if it cannot be displayed

alt

INPUT

text

 

Alternative text for graphic control if it cannot be displayed

archive

APPLET

list of URLs

D

Comma-separated list of preload resources

archive

OBJECT

list of URLs

 

Space-separated list of preload resources

axis

TD, TH

text

 

Names a group of header cells for hierarchical table structures

background

BODY

URL

D

Location of tiling background graphic

bgcolor

TABLE

color

D

Background color for entire table

bgcolor

TR

color

D

Background color for table row

bgcolor

TD, TH

color

D

Background color for table cell

bgcolor

BODY

color

D

Document background color

border

IMG, OBJECT

pixels or %

D

Width of border around linked images or objects

border

TABLE

pixels

(default=1)

 

Width of frame around a table

cellpadding

TABLE

pixels or %

(default=1)

 

Spacing within cells

cellspacing

TABLE

pixels or %

(default=2)

 

Spacing between cells

char

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

character

 

The character along which elements are aligned, such as a decimal point

charoff

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

pixels or %

 

Distance to first occurrence of the alignment character

charset

A, LINK, SCRIPT

character set name

 

Character encoding of the target resource

checked

INPUT

(no explicit value)

 

Sets the initial state of a radio button or checkbox to checked

cite

BLOCKQUOTE, Q

url

 

Location of source document for the quotation

cite

DEL, INS

url

 

Location of document containing explanation for edit

class

All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, STYLE, TITLE

text

 

The class (or list of classes) for the element (used with style sheets)

classid

OBJECT

url

 

URL for the specific implementation

clear

BR

left|all|right|none

(default=none)

D

Used to start flow of text after objects or images aligned against the margins

code

APPLET

applet file

D

Class name of the code to be executed

codebase

OBJECT

url

 

Location of object's codebase (syntax varies by object)

codebase

APPLET

url

D

URL from which the code is retrieved

codetype

OBJECT

MIME type

 

Media type of the code

color

BASEFONT, FONT

color

D

Text color

cols

FRAMESET

list of measurements

 

List of widths (in pixels, %, or relative * values) for columns in a frameset

cols(required)

TEXTAREA

number

(default=1)

 

Width of a textarea form element, measured in number of characters

colspan

TD, TH

number

(default=1)

 

Number of columns spanned by cell

compact

DIR, DL, MENU, OL, UL

(no explicit value)

D

Reduces spacing between items in a list

content (required)

META

text

 

Content of meta information

coords

AREA

x,y coords

 

List of x,y coordinates used in an imagemap; syntax varies according to a given shape

coords

A

x,y coords

 

List of x,y coordinates used in a client-side imagemap

data

OBJECT

url

 

Location of the data used for the object

datetime

DEL, INS

ISO date

 

Date and time of change in ISO format (YYYY-MM-DDThh:mm:ssTZD)

declare

OBJECT

(no explicit value)

 

Declare but don't instantiate flag

defer

SCRIPT

(no explicit value)

 

UA may defer execution of script

dir

All elements but APPLET, BASE, BASEFONT, BDO, BR, FRAME, FRAMESET, HR, IFRAME, PARAM, SCRIPT

ltr|rtl

(default=ltr)

 

Specifies direction (left to right or right to left) for text

dir

BDO

ltr|rtl

(default=ltr)

 

Direction for overridden text

disabled

BUTTON, INPUT, OPTGROUP, OPTION, SELECT, TEXTAREA

(no explicit value)

 

Makes form control unavailable in a given context

enctype

FORM

Content-type

 

Encoding type; defaults to application/x-www-form-urlencoded

face

BASEFONT, FONT

font name

D

Comma-separated list of font names

for

LABEL

ID value

 

Associates the label with a control

frame

TABLE

void|above|below|hsides|lhs|rhs|vsides|box|border

 

Specifies which parts of the table frame to render

frameborder

FRAME, IFRAME

1|0(default=1)

 

Turns display of frame border on or off

headers

TD, TH

ID references

 

List of header cell IDs that are related to the cell

height

IFRAME

pixels or %

 

Height of inline frame

height

IMG, OBJECT

pixels or %

 

Height of image or object (will resize original to match specified size)

height (required)

APPLET

pixels or %

D

Initial height of applet window

height

TD, TH

pixels or %

D

Height for cell

href

A, AREA, LINK

URL

 

Location of target document or resource

href

BASE

URL

 

URL that serves as the base for all links in a document

hreflang

A, LINK

two-character language code

 

Identifies language of target document

hspace

APPLET, IMG, OBJECT

pixels

D

Amount of space held clear to the left and right of the element

http-equiv

META

name

 

HTTP response header name

id

All elements but BASE, HEAD, HTML, META, SCRIPT, STYLE, TITLE

ID

 

A unique ID name given to an instance of an element in a document

ismap

IMG

ismap

 

Indicates image is a server-side imagemap

label

OPTION

text

 

Defines a logical group of options for use in hierarchical menus

label (required)

OPTGROUP

text

 

Defines a logical group of options for use in hierarchical menus

lang

All elements butAPPLET, BASE, BASEFONT, BR, FRAME, FRAMESET, HR, IFRAME, PARAM, SCRIPT

two-character language code

 

Indicates language used in element

language

SCRIPT

script language

D

Predefined script language name

link

BODY

color

D

Color of links in the document

longdesc

IMG

URL

 

Link to long description of image contents (complements alt)

longdesc

FRAME, IFRAME

URL

 

Link to long description (complements title)

marginheight

FRAME, IFRAME

pixels

 

Height of top and bottom margins

marginwidth

FRAME, IFRAME

pixels

 

Width of left and right margins

maxlength

INPUT

number

 

Maximum number of characters in a form field

media

STYLE

comma-separated list of media descriptors

 

Element is designed for use with these media

media

LINK

comma-separated list of media descriptors

 

Selects style sheet for rendering these media

method (required)

FORM

GET|POST

(default=GET)

 

HTTP method used to submit the form

multiple

SELECT

(no explicit value)

 

Allows more than one option to be selected in a menu or scrolling list

name

BUTTON, TEXTAREA, SELECT, INPUT, OBJECT

text

 

Names the parameter to be passed on to the forms processing application

name

APPLET

text

D

Allows applets to find each other

name

FRAME, IFRAME

text

 

Names the frame for targeting

name

A

text

 

Creates named anchor (for linking to a specific spot on a page)

name

IMG

text

 

Name of image for reference in scripting

name (required)

MAP

text

 

Names a client-side imagemap for reference

name (required)

PARAM

text

 

Property name

name

META

text

 

Metainformation name

nohref

AREA

(no explicit value)

 

Indicates an area of a client-side imagemap that has no associated link

noresize

FRAME

(no explicit value)

 

When present, prevents users from resizing frames

noshade

HR

(no explicit value)

D

Turns off 3-D rendering of horizontal rules

nowrap

TD, TH

(no explicit value)

D

Suppresses word wrap

object

APPLET

resource name

D

Serialized applet file

onblur

A, AREA, BUTTON, INPUT, LABEL, SELECT, TEXTAREA

script

 

When focus is removed from an element

onchange

INPUT, SELECT, TEXTAREA

script

 

When element value changes

onclick

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer button is clicked

ondblclick

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer button is double-clicked

onfocus

A, AREA, BUTTON, INPUT, LABEL, SELECT, TEXTAREA

script

 

When focus is applied to an element

onkeydown

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a key is pressed down

onkeypress

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a key is pressed and released

onkeyup

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a key is released

onload

FRAMESET

script

 

When all the frames have been loaded

onload

BODY

script

 

When the document has been loaded

onmousedown

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer button is pressed down

onmousemove

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer is moved within the element

onmouseout

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer is moved out of the element's space

onmouseover

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer was moved onto the element's space

onmouseup

All elements but APPLET, BASE, BASEFONT, BDO, BR, FONT, FRAME, FRAMESET, HEAD, HTML, IFRAME, ISINDEX, META, PARAM, SCRIPT, STYLE, TITLE

script

 

When a pointer button is released

onreset

FORM

script

 

When the form is reset

onselect

INPUT, TEXTAREA

script

 

When some text is selected

onsubmit

FORM

script

 

When the form is submitted

onunload

FRAMESET

script

 

When all the frames have been removed

onunload

BODY

script

 

When the document has been removed

profile

HEAD

URL

 

A metadata profile (dictionary)

prompt

ISINDEX

text

D

Initial message in an isindex search field

readonly

TEXTAREA, INPUT

(no explicit value)

 

Prevents editing of initial value in a form text field (textarea, text password)

rel

A, LINK

link types

 

Comma-separated list of forward link types

rev

A, LINK

link types

 

Comma-separated list of reverse link types

rows

FRAMESET

list of measurements

 

Comma-separated list of heights for the rows of a frameset (in pixels, %, or relative * values)

rows (required)

TEXTAREA

number

 

The number of visible rows in a textarea field

rowspan

TD, TH

number(default=1)

 

The number of rows spanned by cell

rules

TABLE

none|groups|rows|cols|all

 

Specifies where rules are rendered between rows and columns of a table

scheme

META

text

 

Scheme to be used in interpreting the content (varies by context)

scope

TD, TH

row|col|rowgroup|colgroup

 

Set of data cells for which the current header cell provides header information

scrolling

FRAME, IFRAME

yes|no|auto

(default=auto)

 

Indicates when a scrollbar should appear

selected

OPTION

selected

 

Defines initial state of an option as selected

shape (required)

AREA

shape

 

Shape description (rect, circ, poly) used for interpretation of coordinates (for use in client-side imagemaps)

shape

A

shape

 

For use with client-side imagemaps

size

HR

pixels

D

Specifies thickness of horizontal rule

size

FONT

number

D

Font size: absolute (1-7) or relative (+1, -1, etc.)

size

INPUT

number

 

Specific to each type of field

size (required)

BASEFONT

number

D

Base font size for FONT elements (absolute or relative size notation)

size

SELECT

number

 

Number of visible rows in scrolling list

span

COL

number

(default=1)

 

COL attributes affect N columns

span

COLGROUP

number

(default=1)

 

Number of columns in group

src

SCRIPT

url

 

URL for an external script

src

INPUT

url

 

URL for image used as a form button

src

FRAME, IFRAME

url

 

Source of frame content

src (required)

IMG

url

 

URL of image file

standby

OBJECT

text

 

Message to show while loading

start

OL

number

D

The number an ordered list should begin counting from

style

All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, SCRIPT, STYLE, TITLE

style syntax

 

Associated style info

summary

TABLE

text

 

Provides description of table contents for nonvisual browsers

tabindex

A, AREA, BUTTON, INPUT, OBJECT, SELECT, TEXTAREA

number

 

Position in tabbing order

target

A, AREA, BASE, FORM, LINK

window name

 

Targets the window or frame to load the target document. The predefined target names are _blank, _self, _parent, _top

text

BODY

color

D

Document text color

title

STYLE

text

 

Title for the style

title

All elements but BASE, BASEFONT, HEAD, HTML, META, PARAM, STYLE, TITLE

text

 

Specifies an advisory title that may be rendered specially by nonvisual browsers

type

A, LINK

MIME type

 

Advisory content type

type

OBJECT

MIME type

 

Content type for data

type

PARAM

MIME type

 

Content type for value when valuetype=ref

type (required)

SCRIPT

MIME type

 

Content type of script language

type (required)

STYLE

MIME

 

Content type of style language (defaults to text/css)

type (required)

INPUT

text|password|checkbox|radio|submit|reset|file|hidden|image

(default=text)

 

The kind of widget that is needed

type

LI

disc|square|circleor 1|A|a|I|i

(default=disc)

D

The bullet style or numbering scheme for a list item (depending on context)

type

OL

1|A|a|I|i

(default=1)

D

Numbering style

type

UL

disc|square|circle

(default=disc)

D

Bullet style

type (required)

BUTTON

button|submit|reset

(default=submit)

 

For use as form button

usemap

IMG, INPUT, OBJECT

url

 

A fragment identifier that points to the map element for a client-side imagmap

valign

COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, TR

top|middle|bottom|baseline

(default=middle)

 

Vertical alignment in cells

value

OPTION

alphanumeric text

 

The value of the option when selected; defaults to content of the option container

value

PARAM

alphanumeric

 

Property value

value

INPUT, BUTTON

value

 

Value of input element, which is passed on to the forms processing program

value

LI

number

D

Resets sequence number

valuetype

PARAM

data|ref|object

 

How to interpret value

version

HTML

url

D

Link to DTD for the document

vlink

BODY

color

D

Color of visited links

vspace

APPLET, IMG, OBJECT

pixels

D

Amount of space held clear above and below an element

width

HR

pixels or %

D

Length of horizontal rule

width

IFRAME

pixels or %

 

Frame width

width

IMG, OBJECT

pixels or %

 

Size of image or object; browser resizes elements to match specified values

width

TABLE

pixels or %

 

Table width

width (required)

APPLET

pixels or %

D

Initial width of applet

width

COL

pixels, %, or *

 

Column width specification

width

COLGROUP

pixels, %, or *

 

Default width for enclosed COLs

width

TD, TH

pixels or %

D

Width for cell

width

PRE

number

D

Specifies maximum width for preformatted text



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.