|
The HTML 4 attributes
|
Here are all attributes that may be used within HTML tags.
means that this attribute is required with the given tags.
means that this attribute is deprecated, usually because the corresponding tags are also deprecated.
CDATA is a sequence of characters from the document character set and may include character entities.
Pixel is an integer that represents the number of pixels of the canvas (screen, paper).
Length may be either pixels or a percentage of the available horizontal or vertical space.
MultiLength may be a length or a relative length. A relative length has the form "i*", where "i" is an integer.
Datetime is a date/time represented with the legal format: YYYY-MM-DDThh:mm:ssTZD (see the complete type definition for Datetime).
FrameTarget is the name of a frame or one of these reserved words: _blank (new, unnamed window), _self (the current frame that contains referer), _parent (immediate FRAMESET parent of the current frame), _top (full, original window).
MediaDesc is a media descriptor. A list of recognized media descriptors: screen, tty, tv, projection, handheld, print, braille, aural. See http://www.w3.org/TR/html4/types.html#type-media-descriptors.
Longer descriptions for these types here: http://www.w3.org/TR/html4/types.html.
N.B.: the attribute bordercolor, often used with tables, has never been officially defined in HTML.
It is actually an improvement from Microsoft and Netscape to change the color of tables' borders. To do this, you should use style sheets (see tables).
| |
|
name |
tags |
format/value |
comment |
| |
|
abbr |
TD,
TH
|
text |
abbreviation for header cell |
| |
|
accept-charset |
FORM |
charsets |
list of supported charsets |
| |
|
accept |
FORM,
INPUT
|
content types |
list of MIME types for file upload |
| |
|
accesskey |
A,
AREA,
BUTTON,
INPUT,
LABEL,
LEGEND,
TEXTAREA
|
character |
accessibility key character |
 |
|
action |
FORM |
URI |
server-side form handler |
| |
 |
align |
CAPTION |
top, bottom, left, right |
relative to table |
| |
 |
align |
APPLET,
IFRAME,
IMG,
INPUT,
OBJECT
|
bottom, middle, top, left, right |
vertical or horizontal alignment |
| |
 |
align |
LEGEND |
top, bottom, left, right |
relative to fieldset |
| |
 |
align |
TABLE |
left, center, right |
table position relative to window |
| |
 |
align |
HR |
left, center, right |
horizontal alignment of the rule |
| |
 |
align |
DIV,
H1,
H2,
H3,
H4,
H5,
H6,
P
|
left, center, right, justify |
align, text alignment |
| |
|
align |
COL,
COLGROUP,
TBODY,
TD,
TFOOT,
TH,
THEAD,
TR
|
left, center, right, justify, char |
alignment of data and the justification of text in a cell |
| |
 |
alink |
BODY |
color |
color of selected links |
| |
 |
alt |
APPLET |
text |
short description |
 |
|
alt |
AREA,
IMG
|
text |
short description |
| |
|
alt |
INPUT |
CDATA |
short description |
| |
 |
archive |
APPLET |
CDATA |
comma-separated archive list |
| |
|
archive |
OBJECT |
CDATA |
space-separated list of URIs |
| |
|
axis |
TD,
TH
|
CDATA |
comma-separated list of related headers |
| |
 |
background |
BODY |
URI |
texture tile for document background |
| |
 |
bgcolor |
TABLE |
color |
background color for cells |
| |
 |
bgcolor |
TR |
color |
background color for row |
| |
 |
bgcolor |
TD,
TH
|
color |
cell background color |
| |
 |
bgcolor |
BODY |
color |
document background color |
| |
|
border |
TABLE |
pixels |
frame width around table |
| |
 |
border |
IMG,
OBJECT
|
pixels |
link border width |
| |
|
cellpadding |
TABLE |
length |
spacing within cells |
| |
|
cellspacing |
TABLE |
length |
spacing between cells |
| |
|
char |
COL,
COLGROUP,
TBODY,
TD,
TFOOT,
TH,
THEAD,
TR
|
character |
alignment char, e.g. char=":" |
| |
|
charoff |
COL,
COLGROUP,
TBODY,
TD,
TFOOT,
TH,
THEAD,
TR
|
length |
offset for alignment char |
| |
|
charset |
A,
LINK,
SCRIPT
|
charset |
char encoding of linked resource |
| |
|
checked |
INPUT |
no value |
for radio buttons and check boxes |
| |
|
cite |
BLOCKQUOTE,
Q
|
URI |
URI for source document or msg |
| |
|
cite |
DEL,
INS
|
URI |
info on reason for change |
| |
|
class |
all elements
but BASE,
BASEFONT,
HEAD,
HTML,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
CDATA |
space-separated list of classes |
| |
|
classid |
OBJECT |
URI |
identifies an implementation |
| |
 |
clear |
BR |
left, all, right, none |
control of text flow. Default is none. |
| |
 |
code |
APPLET |
CDATA |
applet class file |
| |
|
codebase |
OBJECT |
URI |
base URI for classid, data, archive |
| |
 |
codebase |
APPLET |
URI |
optional base URI for applet |
| |
|
codetype |
OBJECT |
content type |
content type for code |
| |
 |
color |
BASEFONT,
FONT
|
color |
text color |
| |
|
cols |
FRAMESET |
MultiLengths |
list of lengths, default: 100% (1 col) |
 |
|
cols |
TEXTAREA |
number |
the visible width in average character widths |
| |
|
colspan |
TD,
TH
|
number |
number of cols spanned by cell. Default is 1. |
| |
 |
compact |
DIR,
DL,
MENU,
OL,
UL
|
no value |
reduced interitem spacing |
 |
|
content |
META |
CDATA |
associated information |
| |
|
coords |
AREA |
lengths |
comma-separated list of lengths |
| |
|
coords |
A |
lengths |
for use with client-side image maps |
| |
|
data |
OBJECT |
URI |
reference to object's data |
| |
|
datetime |
DEL,
INS
|
Datetime |
date and time of change |
| |
|
declare |
OBJECT |
no value |
declare but don't instantiate flag |
| |
|
defer |
SCRIPT |
no value |
UA may defer execution of script |
| |
|
dir |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FRAME,
FRAMESET,
IFRAME,
PARAM,
SCRIPT
|
ltr, rtl |
direction for weak/neutral text |
 |
|
dir |
BDO |
ltr, rtl |
directionality |
| |
|
disabled |
BUTTON,
INPUT,
OPTGROUP,
OPTION,
SELECT,
TEXTAREA
|
no value |
unavailable in this context |
| |
|
enctype |
FORM |
content type |
the content type used to submit the form to the server. Default is "application/x-www-form-urlencoded". |
| |
 |
face |
BASEFONT,
FONT
|
CDATA |
comma-separated list of font names |
| |
|
for |
LABEL |
ID |
matches field ID value |
| |
|
frame |
TABLE |
void, above, below, hsides, lhs, rhs, vsides, box, border |
which parts of frame to render |
| |
|
frameborder |
FRAME,
IFRAME
|
1, 0 |
request frame borders? Default is 1. |
| |
|
headers |
TD,
TH
|
IDs |
list of id's for header cells |
| |
|
height |
IFRAME |
length |
frame height |
| |
 |
height |
TD,
TH
|
length |
height for cell |
| |
|
height |
IMG,
OBJECT
|
length |
override height |
 |
 |
height |
APPLET |
length |
initial height |
| |
|
href |
A,
AREA,
LINK
|
URI |
URI for linked resource |
| |
|
href |
BASE |
URI |
URI that acts as base URI |
| |
|
hreflang |
A,
LINK
|
language code |
language code |
| |
 |
hspace |
APPLET,
IMG,
OBJECT
|
pixels |
horizontal gutter |
| |
|
http-equiv |
META |
name |
HTTP response header name |
| |
|
id |
all elements
but BASE,
HEAD,
HTML,
META,
SCRIPT,
STYLE,
TITLE
|
ID |
document-wide unique id |
| |
|
ismap |
IMG,
INPUT
|
no value |
use server-side image map |
| |
|
label |
OPTION |
text |
for use in hierarchical menus |
 |
|
label |
OPTGROUP |
text |
for use in hierarchical menus |
| |
|
lang |
all elements
but APPLET,
BASE,
BASEFONT,
BR,
FRAME,
FRAMESET,
IFRAME,
PARAM,
SCRIPT
|
language code |
language code |
| |
 |
language |
SCRIPT |
CDATA |
predefined script language name |
| |
 |
link |
BODY |
color |
color of links |
| |
|
longdesc |
IMG |
URI |
link to long description (complements alt) |
| |
|
longdesc |
FRAME,
IFRAME
|
URI |
link to long description (complements title) |
| |
|
marginheight |
FRAME,
IFRAME
|
pixels |
margin height in pixels |
| |
|
marginwidth |
FRAME,
IFRAME
|
pixels |
margin width in pixels |
| |
|
maxlength |
INPUT |
number |
max chars for text fields |
| |
|
media |
STYLE |
MediaDesc |
designed for use with these media |
| |
|
media |
LINK |
MediaDesc |
for rendering on these media |
| |
|
method |
FORM |
GET, POST |
HTTP method used to submit the form. Default is GET. |
| |
|
multiple |
SELECT |
no value |
multiple selection or not in this SELECT. Default is single selection |
| |
|
name |
BUTTON,
TEXTAREA
|
CDATA |
assigns the control name |
| |
 |
name |
APPLET |
CDATA |
allows applets to find each other |
| |
|
name |
SELECT |
CDATA |
field name |
| |
|
name |
FORM |
CDATA |
name of form for scripting |
| |
|
name |
FRAME,
IFRAME
|
CDATA |
name of frame for targetting |
| |
|
name |
IMG |
CDATA |
name of image for scripting |
| |
|
name |
A |
CDATA |
named link end |
| |
|
name |
INPUT,
OBJECT
|
CDATA |
submit as part of form |
 |
|
name |
MAP |
CDATA |
for reference by usemap |
 |
|
name |
PARAM |
CDATA |
property name |
| |
|
name |
META |
name |
metainformation name |
| |
|
nohref |
AREA |
no value |
this region has no action |
| |
|
noresize |
FRAME |
no value |
allow users to resize frames? |
| |
 |
noshade |
HR |
no value |
the rule is rendered in a solid color rather than as the traditional two-color "groove" |
| |
 |
nowrap |
TD,
TH
|
no value |
suppress word wrap |
| |
 |
object |
APPLET |
CDATA |
serialized applet file |
| |
|
onblur |
A,
AREA,
BUTTON,
INPUT,
LABEL,
SELECT,
TEXTAREA
|
script data |
the element lost the focus |
| |
|
onchange |
INPUT,
SELECT,
TEXTAREA
|
script data |
the element value was changed |
| |
|
onclick |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a pointer button was clicked |
| |
|
ondblclick |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a pointer button was double clicked |
| |
|
onfocus |
A,
AREA,
BUTTON,
INPUT,
LABEL,
SELECT,
TEXTAREA
|
script data |
the element got the focus |
| |
|
onkeydown |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a key was pressed down |
| |
|
onkeypress |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a key was 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 data |
a key was released |
| |
|
onload |
FRAMESET |
script data |
all the frames have been loaded |
| |
|
onload |
BODY |
script data |
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 data |
a pointer button was pressed down |
| |
|
onmousemove |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a pointer was moved within |
| |
|
onmouseout |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a pointer was moved away |
| |
|
onmouseover |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a pointer was moved onto |
| |
|
onmouseup |
all elements
but APPLET,
BASE,
BASEFONT,
BDO,
BR,
FONT,
FRAME,
FRAMESET,
HEAD,
HTML,
IFRAME,
ISINDEX,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
script data |
a pointer button was released |
| |
|
onreset |
FORM |
script data |
the form was reset |
| |
|
onselect |
INPUT,
TEXTAREA
|
script data |
some text was selected |
| |
|
onsubmit |
FORM |
script data |
the form was submitted |
| |
|
onunload |
FRAMESET |
script data |
all the frames have been removed |
| |
|
onunload |
BODY |
script data |
the document has been removed |
| |
|
profile |
HEAD |
URI |
named dictionary of meta info |
| |
 |
prompt |
ISINDEX |
text |
prompt message |
| |
|
readonly |
TEXTAREA |
no value |
prohibits changes to the control |
| |
|
readonly |
INPUT |
no value |
for text and passwd |
| |
|
rel |
A,
LINK
|
link types |
forward link types |
| |
|
rev |
A,
LINK
|
link types |
reverse link types |
| |
|
rows |
FRAMESET |
MultiLengths |
list of lengths, default: 100% (1 row) |
 |
|
rows |
TEXTAREA |
number |
|
| |
|
rowspan |
TD,
TH
|
number |
number of rows spanned by cell. Default is 1. |
| |
|
rules |
TABLE |
none, groups, rows, cols, all |
rulings between rows and cols. Default is none. |
| |
|
scheme |
META |
CDATA |
select form of content |
| |
|
scope |
TD,
TH
|
row, col, rowgroup, colgroup |
scope covered by header cells |
| |
|
scrolling |
FRAME,
IFRAME
|
yes, no, auto |
scrollbar or none. Default is auto. |
| |
|
selected |
OPTION |
no value |
|
| |
|
shape |
AREA |
rect, circle, poly, default |
controls interpretation of coords. Default is rect. |
| |
|
shape |
A |
rect, circle, poly, default |
for use with client-side image maps. Default is rect. |
| |
 |
size |
HR |
pixels |
height of the rule |
| |
 |
size |
FONT |
[+|-]nn (e.g. size="+1", size="4") |
font size |
| |
|
size |
INPUT |
CDATA |
width of the control. In pixels except for text and password (number of characters). |
 |
 |
size |
BASEFONT |
CDATA |
base font size for FONT elements |
| |
|
size |
SELECT |
number |
rows visible |
| |
|
span |
COL |
number |
COL attributes affect N columns. Default is 1. |
| |
|
span |
COLGROUP |
number |
default number of columns in group. Default is 1. |
| |
|
src |
SCRIPT |
URI |
URI for an external script |
| |
|
src |
INPUT |
URI |
for fields with images |
| |
|
src |
FRAME,
IFRAME
|
URI |
source of frame content |
 |
|
src |
IMG |
URI |
URI of image to embed |
| |
|
standby |
OBJECT |
text |
message to show while loading |
| |
 |
start |
OL |
number |
starting sequence number |
| |
|
style |
all elements
but BASE,
BASEFONT,
HEAD,
HTML,
META,
PARAM,
SCRIPT,
STYLE,
TITLE
|
style sheet |
associated style info |
| |
|
summary |
TABLE |
text |
purpose/structure for speech output |
| |
|
tabindex |
A,
AREA,
BUTTON,
INPUT,
OBJECT,
SELECT,
TEXTAREA
|
number |
position in tabbing order |
| |
|
target |
A,
AREA,
BASE,
FORM,
LINK
|
FrameTarget |
render in this frame |
| |
 |
text |
BODY |
color |
document text color |
| |
|
title |
all elements
but BASE,
BASEFONT,
HEAD,
HTML,
META,
PARAM,
SCRIPT,
TITLE
|
text |
advisory title |
| |
|
type |
A,
LINK
|
content type |
advisory content type |
| |
|
type |
OBJECT |
content type |
content type for data |
| |
|
type |
PARAM |
content type |
content type for value when valuetype=ref |
 |
|
type |
SCRIPT |
content type |
content type of script language |
 |
|
type |
STYLE |
content type |
content type of style language |
| |
|
type |
INPUT |
text, password, checkbox, radio, submit, reset, file, hidden, image, button |
what kind of widget is needed. Default is text. |
| |
 |
type |
LI |
disc, square, circle (for UL), 1, A, a, I, i (for OL) |
list item style |
| |
 |
type |
OL |
1, A, a, I, i |
numbering style |
| |
 |
type |
UL |
disc, square, circle |
bullet style |
| |
|
type |
BUTTON |
button, submit, reset |
for use as form button. Default is submit. |
| |
|
usemap |
IMG,
INPUT,
OBJECT
|
URI |
use client-side image map |
| |
|
valign |
COL,
COLGROUP,
TBODY,
TD,
TFOOT,
TH,
THEAD,
TR
|
top, middle, bottom, baseline |
vertical alignment in cells |
| |
|
value |
INPUT |
CDATA |
Specify for radio buttons and checkboxes |
| |
|
value |
OPTION |
CDATA |
defaults to element content |
| |
|
value |
PARAM |
CDATA |
property value |
| |
|
value |
BUTTON |
CDATA |
sent to server when submitted |
| |
 |
value |
LI |
number |
reset sequence number |
| |
|
valuetype |
PARAM |
data, ref, object |
how to interpret value. Default is data. |
| |
 |
version |
HTML |
CDATA |
the HTML version used for this document |
| |
 |
vlink |
BODY |
color |
color of visited links |
| |
 |
vspace |
APPLET,
IMG,
OBJECT
|
pixels |
vertical gutter |
| |
 |
width |
HR |
length |
|
| |
|
width |
IFRAME |
length |
frame width |
| |
|
width |
IMG,
OBJECT
|
length |
override width |
| |
|
width |
TABLE |
length |
table width |
| |
 |
width |
TD,
TH
|
length |
width for cell |
 |
 |
width |
APPLET |
length |
initial width |
| |
|
width |
COL |
MultiLength |
column width specification |
| |
|
width |
COLGROUP |
MultiLength |
default width for enclosed COLs |
| |
 |
width |
PRE |
number |
suggested width in number of characters for the rendering of the PRE block |
References
printable format
|