Complete Guide to (X)HTML Elements and Attributes

(X)HTML Elements and Attributes

Tag/Attribute(s)DescriptionVers.
–most tags–The following attributes may be used with most (X)HTML tags 
classFor identifying a set of tags in order to apply styles 
eventFor triggering a script 
idFor identifying particular tags for JavaScript functions and styles 
langFor specifying the language an element is written in 
styleFor adding local style sheet information 
titleFor labeling elements with tool tips 
!–For inserting invisible comments 
!doctypeRequired. For indicating version of (X)HTML used 
aFor creating links and anchors 
accesskeyFor adding a keyboard shortcut to a link 
eventFor triggering a script 
hrefFor specifying URL of page or name of anchor that link goes to 
nameFor marking a specific area of page that a link might jump to 
tabindexFor defining the order in which the Tab key takes the visitor through links and form elements 
targetFor specifying a particular window or frame for a linkD
abbrFor explaining meaning of abbreviations 
acronymFor explaining meaning of acronyms 
addressFor formatting the e-mail address of the Web page designer 
appletFor inserting appletsD
codeFor specifying the URL of the applet’s codeD
width, heightFor specifying width and height of an appletD
areaFor specifying coordinates of image maps 
accesskeyFor adding a keyboard shortcut to a particular region of the map 
altFor giving information about an area 
coordsFor giving coordinates of area in image map 
hrefFor specifying destination URL of link in area in image map 
nohrefFor making a click in image map have no effect 
shapeFor specifying shape of area in image map 
targetFor specifying window or frame that link should be displayed inD
bFor displaying text in boldface 
base  
hrefFor specifying the URL to be used to generate relative URLs 
targetFor specifying the default target for the links on the pageD
basefontFor specifying default font specifications throughout pageD
colorFor specifying the default color for textD
faceFor specifying the default font for textD
sizeFor specifying the default size for textD
bgsoundFor inserting background sound for pageIE
loopFor specifying how many times sound should playIE
srcFor specifying URL of soundIE
bigFor making text bigger than surrounding text 
blinkFor making text disappear and reappearN
blockquoteFor setting off block of text on page 
citeFor giving the URL of the source of the quote 
bodyFor enclosing main section of page 
alink, link, vlinkFor specifying color of active links, new links, and visited links D
backgroundFor specifying a background imageD
bgcolorFor specifying the background colorD
leftmargin, 
topmargin
For specifying left and top marginsIE
textFor specifying color of textD
brFor creating a line break 
clearFor stopping text wrapD
buttonFor creating buttons 
accesskeyFor adding a keyboard shortcut to a button 
disabledTo gray out a button until some other event occurs 
eventFor associating the button with a script 
nameFor identifying buttons (perhaps for a JavaScript function) 
typeFor using the button as a form element 
valueFor specifying what kind of button to create 
captionFor creating a caption for a table 
alignFor placing caption above or below tableD
centerFor centering text, images, or other elementsD
citeFor marking text as a citation 
codeFor marking text as computer code 
colFor joining columns in a table into a non-structural group 
align, valignFor specifying alignment of columns in column group 
spanFor specifying number of columns in column group 
widthFor specifying a column’s width 
colgroupFor joining columns in a table into a structural column group 
align, valignFor specifying alignment of columns in column group 
spanFor specifying number of columns in column group 
widthFor specifying the default width for the enclosed colelements 
ddFor marking a definition in a list 
delTo mark deleted text by striking it out 
divFor dividing a page into logical sections 
alignFor aligning a given section to left, right, or centerD
classFor giving a name to each class of divisions 
idFor giving a unique name to a particular division 
dlFor creating a definition list 
dtFor marking a term to be defined in a list 
emFor emphasizing text, usually with italics 
embedFor adding multimediaN+IE*
alignFor aligning controlsN+IE*
autostartFor making multimedia event begin automaticallyN+IE*
controlsFor displaying play, pause, rewind buttonsN+IE*
loopFor determining if multimedia event should play more than onceN+IE*
srcFor specifying URL of multimedia fileN+IE*
width, heightFor specifying size of controlsN+IE*
fieldsetFor grouping a set of form elements together 
fontFor changing the size, face, and color of textD
colorFor changing text colorD
faceFor changing text fontD
sizeFor changing text sizeD
formFor creating fill-in forms 
actionFor giving URL of CGI script for form 
enctypeFor uploading files in the proper format 
methodFor determining how form should be processed 
frameFor creating framesF
borderFor determining thickness of frame bordersN+IE
bordercolorFor determining color of frame bordersN+IE
frameborderFor displaying or hiding frame bordersF
framespacingFor adding space between framesIE
longdescFor linking to a document with more informationF
nameFor naming frame so it can be used as targetF
noresizeFor keeping users from resizing a frameF
marginwidth, 
marginheight
For specifying a frame’s left and right, and top and bottom margins F
scrollingFor displaying or hiding a frame’s scrollbarsF
srcFor specifying initial URL to be displayed in frameF
targetFor specifying which frame a link should be opened inF
titleFor indicating a frame’s purposeF
framesetFor defining a framesetF
borderFor determining thickness of frame bordersN+IE
bordercolorFor determining color of frame bordersN+IE
colsFor determining number and size of framesF
frameborderFor displaying or hiding frame bordersF
framespacingFor adding space between framesIE
rowsFor determining number and size of framesF
h1, h2, h3, h4, h5, h6For creating headers 
alignFor aligning headersD
headFor creating head section of page 
hrFor creating horizontal rules 
alignFor aligning horizontal rulesD
noshadeFor displaying horizontal rules without shadingD
sizeFor specifying height of horizontal ruleD
widthFor specifying width of horizontal ruleD
htmlFor identifying a text document as an HTML document 
iFor displaying text in italics 
iframeFor creating floating framesD*
alignFor aligning floating framesD*
frameborderFor displaying or hiding frame bordersD*
heightFor specifying the height of an iframeD*
nameFor specifying the name of the floating frame, to be used as a targetD*
width, heightFor specifying size of floating frameD*
scrollingFor displaying or hiding scrollbarsD*
srcFor specifying the URL of the initial pageD*
imgFor inserting images on a page 
alignFor aligning images and for wrapping text around imagesD
altFor offering alternate text that is displayed if image is not 
borderFor specifying the thickness of the border, if anyD
hspace, vspaceFor specifying amount of space above and below, and to the sides of an imageD
srcFor specifying URL of image 
usemapFor specifying the image map that should be used with the referenced image 
width, heightFor specifying size of image so that page is loaded more quickly, or for scaling 
inputFor creating form elements 
accesskeyFor adding a keyboard shortcut to a form element 
alignFor aligning form elementsD
checkedFor marking a radio button or check box by default 
disabledFor graying out form elements until some other event occurs 
eventFor triggering a script with an event like ONFOCUS, ONBLUR, etc. 
maxlengthFor determining maximum amount of characters that can be entered in form element 
nameFor identifying data collected by this element 
sizeFor specifying width of text or password box 
srcFor specifying URL of active image 
readonlyFor keeping visitors from changing certain form elements 
tabindexFor specifying the order in which the Tab key should take a visitor through the links and form elements 
typeFor determining type of form element 
valueFor specifying initial value of form element 
insFor marking inserted text with an underline 
kbdFor marking keyboard text 
labelFor labeling form elements 
forFor specifying which form element the label belongs to 
layerFor positioning elementsN
legendFor labeling fieldsets 
alignFor aligning legendsD
liFor creating a list item 
typeFor determining which symbols should begin the list itemD
valueFor determining the initial value of the first list itemD
linkFor linking to an external style sheet 
hrefFor specifying the URL of the style sheet 
mediaFor noting a style sheet’s purpose 
titleFor labeling alternate style sheets 
typeFor noting a style sheet’s MIME type 
relFor indicating that a style sheet is primary or alternate 
mapFor creating a client-side image map 
nameFor naming map so it can be referenced later 
marqueeFor creating moving textIE
behaviorFor controlling how the text should move (scroll, slide, alternate)IE
directionFor controlling if the text moves from left to right or right to leftIE
loopFor specifying repetitionsIE
scrollamountFor specifying amount of space between each marquee repetitionIE
scrolldelayFor specifying amount of time between each marquee repetitionIE
meta  
contentFor adding extra information about the Web page itself 
http-equivFor creating automatic jumps to other pages, setting the default scripting language, and declaring the character encoding 
nameFor identifying extra information to the Web page 
nobrFor keeping all the enclosed elements on one lineN+IE
noframesFor providing alternatives to framesF
noscriptFor providing alternatives to scripts 
objectFor embedding objects in Web pages 
alignFor aligning objectsD
borderFor creating (or hiding) a border around an objectD
classidFor identifying the kind of object being embedded 
codebaseFor defining the base URL of the source object 
dataFor identifying the source of the multimedia file to be embedded 
hspace, vspaceFor specifying amount of space around an objectD
nameFor identifying the object 
standbyFor displaying a message as the object is loading 
typeFor noting the an object’s MIME type 
width, heightFor specifying the dimensions of the object’s box 
olFor creating ordered lists 
typeFor specifying the symbols that should begin each list itemD
startFor specifying the initial value of the first list itemD
optgroupFor dividing a menu into submenus 
disabledFor graying out menu options until some other event occurs 
labelFor specifying how the option should appear in the menu 
optionFor creating the individual options in a form menu 
disabledFor graying out menu options until some other event occurs 
labelFor specifying how the option should appear in the menu 
selectedFor making a menu option be selected by default in a blank form 
valueFor specifying the initial value of a menu option 
pFor creating new paragraphs 
alignFor aligning paragraphsD
paramFor setting properties of an object 
nameFor identifying the kind of property 
valueFor setting the value of the named property 
preFor displaying text exactly as it appears in HTML document 
qFor quoting short passages of text 
citeFor giving the URL of the source of the quote 
s(Same as STRIKE) For displaying text with a line through itD
sampFor displaying sample text–in a monospaced font 
scriptFor adding “automatic” scripts to a page 
charsetFor specifying the character set an external script is written in 
languageFor specifying the scripting language the script is written inD
srcFor referencing an external script 
typeFor specifying the scripting language the script is written in 
selectFor creating menus in forms 
disabledFor graying out menu options until some other event occurs 
nameFor identifying the data collected by the menu 
multipleFor allowing users to choose more than one option in the menu 
sizeFor specifying the number of items initially visible in the menu 
smallFor decreasing the size of text 
spanFor creating custom character styles 
classFor naming individual custom character styles 
idFor identifying particular HTML elements 
strike(Same as S) For displaying text with a line through itD
strongFor emphasizing text logically, usually in boldface 
styleFor adding style sheet information to a page 
mediaFor indicating a style sheet’s purpose 
typeFor indicating a style sheet’s MIME type 
subFor creating subscripts 
supFor creating superscripts 
tableFor creating tables 
alignFor aligning an entire table with respect to the windowD
backgroundFor specifying a background image for the tableN+IE
bgcolorFor specifying the background color of the tableD
borderFor specifying the thickness, if any, of the border 
bordercolorFor specifying a solid color for the borderIE
bordercolordarkFor specifying the darker (shaded) color of the borderIE
bordercolorlightFor specifying the lighter (highlighted) color of the borderIE
cellpaddingFor setting the space between a cell’s contents and its borders 
cellspacingFor setting the amount of space between cells 
frameFor displaying external borders 
heightFor specifying the height of the tableN+IE
rulesFor displaying internal borders 
widthFor specifying the size of the table 
tbodyFor identifying the body of the table 
align, valignFor aligning the contents of the body of the table 
td; thFor creating regular and header cells, respectively, in a table 
align, valignFor aligning a cell’s contents horizontally or vertically 
bgcolorFor changing the background color of a cellD
charFor aligning the contents of a cell with respect to a character 
colspanFor spanning a cell across more than one column 
nowrapFor keeping a cell’s contents on one lineD
rowspanFor spanning a cell across more than one row 
width, heightFor specifying the size of the cellD
textareaFor creating text block entry areas in a form 
accesskeyFor adding a keyboard shortcut to a text area 
disabledFor graying out a text block until some other event occurs 
nameFor identifying the data that is gathered with the text block 
readonlyFor protecting a text area’s contents 
rows, colsFor specifying the number of rows and columns in the text block 
tfoot, theadFor identifying the footer and header area of a table 
align, valignFor aligning the footer or header cells 
titleRequired. For creating the title of the page in title bar area  
trFor creating rows in a table 
align, valignFor aligning contents of row horizontally or vertically 
bgcolorFor changing color of entire rowD
ttFor displaying text in monospaced font 
uFor displaying text with line underneath itD
ulFor creating unordered lists 
typeFor specifying the markers that should precede each list itemD
wbrFor creating discretional line breaksN+IE