Complete Guide to (X)HTML Elements and Attributes
(X)HTML Elements and Attributes
| Tag/Attribute(s) | Description | Vers. |
|---|---|---|
| –most tags– | The following attributes may be used with most (X)HTML tags | |
| class | For identifying a set of tags in order to apply styles | |
| event | For triggering a script | |
| id | For identifying particular tags for JavaScript functions and styles | |
| lang | For specifying the language an element is written in | |
| style | For adding local style sheet information | |
| title | For labeling elements with tool tips | |
| !– | For inserting invisible comments | |
| !doctype | Required. For indicating version of (X)HTML used | |
| a | For creating links and anchors | |
| accesskey | For adding a keyboard shortcut to a link | |
| event | For triggering a script | |
| href | For specifying URL of page or name of anchor that link goes to | |
| name | For marking a specific area of page that a link might jump to | |
| tabindex | For defining the order in which the Tab key takes the visitor through links and form elements | |
| target | For specifying a particular window or frame for a link | D |
| abbr | For explaining meaning of abbreviations | |
| acronym | For explaining meaning of acronyms | |
| address | For formatting the e-mail address of the Web page designer | |
| applet | For inserting applets | D |
| code | For specifying the URL of the applet’s code | D |
| width, height | For specifying width and height of an applet | D |
| area | For specifying coordinates of image maps | |
| accesskey | For adding a keyboard shortcut to a particular region of the map | |
| alt | For giving information about an area | |
| coords | For giving coordinates of area in image map | |
| href | For specifying destination URL of link in area in image map | |
| nohref | For making a click in image map have no effect | |
| shape | For specifying shape of area in image map | |
| target | For specifying window or frame that link should be displayed in | D |
| b | For displaying text in boldface | |
| base | ||
| href | For specifying the URL to be used to generate relative URLs | |
| target | For specifying the default target for the links on the page | D |
| basefont | For specifying default font specifications throughout page | D |
| color | For specifying the default color for text | D |
| face | For specifying the default font for text | D |
| size | For specifying the default size for text | D |
| bgsound | For inserting background sound for page | IE |
| loop | For specifying how many times sound should play | IE |
| src | For specifying URL of sound | IE |
| big | For making text bigger than surrounding text | |
| blink | For making text disappear and reappear | N |
| blockquote | For setting off block of text on page | |
| cite | For giving the URL of the source of the quote | |
| body | For enclosing main section of page | |
| alink, link, vlink | For specifying color of active links, new links, and visited links | D |
| background | For specifying a background image | D |
| bgcolor | For specifying the background color | D |
| leftmargin, topmargin | For specifying left and top margins | IE |
| text | For specifying color of text | D |
| br | For creating a line break | |
| clear | For stopping text wrap | D |
| button | For creating buttons | |
| accesskey | For adding a keyboard shortcut to a button | |
| disabled | To gray out a button until some other event occurs | |
| event | For associating the button with a script | |
| name | For identifying buttons (perhaps for a JavaScript function) | |
| type | For using the button as a form element | |
| value | For specifying what kind of button to create | |
| caption | For creating a caption for a table | |
| align | For placing caption above or below table | D |
| center | For centering text, images, or other elements | D |
| cite | For marking text as a citation | |
| code | For marking text as computer code | |
| col | For joining columns in a table into a non-structural group | |
| align, valign | For specifying alignment of columns in column group | |
| span | For specifying number of columns in column group | |
| width | For specifying a column’s width | |
| colgroup | For joining columns in a table into a structural column group | |
| align, valign | For specifying alignment of columns in column group | |
| span | For specifying number of columns in column group | |
| width | For specifying the default width for the enclosed colelements | |
| dd | For marking a definition in a list | |
| del | To mark deleted text by striking it out | |
| div | For dividing a page into logical sections | |
| align | For aligning a given section to left, right, or center | D |
| class | For giving a name to each class of divisions | |
| id | For giving a unique name to a particular division | |
| dl | For creating a definition list | |
| dt | For marking a term to be defined in a list | |
| em | For emphasizing text, usually with italics | |
| embed | For adding multimedia | N+IE* |
| align | For aligning controls | N+IE* |
| autostart | For making multimedia event begin automatically | N+IE* |
| controls | For displaying play, pause, rewind buttons | N+IE* |
| loop | For determining if multimedia event should play more than once | N+IE* |
| src | For specifying URL of multimedia file | N+IE* |
| width, height | For specifying size of controls | N+IE* |
| fieldset | For grouping a set of form elements together | |
| font | For changing the size, face, and color of text | D |
| color | For changing text color | D |
| face | For changing text font | D |
| size | For changing text size | D |
| form | For creating fill-in forms | |
| action | For giving URL of CGI script for form | |
| enctype | For uploading files in the proper format | |
| method | For determining how form should be processed | |
| frame | For creating frames | F |
| border | For determining thickness of frame borders | N+IE |
| bordercolor | For determining color of frame borders | N+IE |
| frameborder | For displaying or hiding frame borders | F |
| framespacing | For adding space between frames | IE |
| longdesc | For linking to a document with more information | F |
| name | For naming frame so it can be used as target | F |
| noresize | For keeping users from resizing a frame | F |
| marginwidth, marginheight | For specifying a frame’s left and right, and top and bottom margins | F |
| scrolling | For displaying or hiding a frame’s scrollbars | F |
| src | For specifying initial URL to be displayed in frame | F |
| target | For specifying which frame a link should be opened in | F |
| title | For indicating a frame’s purpose | F |
| frameset | For defining a frameset | F |
| border | For determining thickness of frame borders | N+IE |
| bordercolor | For determining color of frame borders | N+IE |
| cols | For determining number and size of frames | F |
| frameborder | For displaying or hiding frame borders | F |
| framespacing | For adding space between frames | IE |
| rows | For determining number and size of frames | F |
| h1, h2, h3, h4, h5, h6 | For creating headers | |
| align | For aligning headers | D |
| head | For creating head section of page | |
| hr | For creating horizontal rules | |
| align | For aligning horizontal rules | D |
| noshade | For displaying horizontal rules without shading | D |
| size | For specifying height of horizontal rule | D |
| width | For specifying width of horizontal rule | D |
| html | For identifying a text document as an HTML document | |
| i | For displaying text in italics | |
| iframe | For creating floating frames | D* |
| align | For aligning floating frames | D* |
| frameborder | For displaying or hiding frame borders | D* |
| height | For specifying the height of an iframe | D* |
| name | For specifying the name of the floating frame, to be used as a target | D* |
| width, height | For specifying size of floating frame | D* |
| scrolling | For displaying or hiding scrollbars | D* |
| src | For specifying the URL of the initial page | D* |
| img | For inserting images on a page | |
| align | For aligning images and for wrapping text around images | D |
| alt | For offering alternate text that is displayed if image is not | |
| border | For specifying the thickness of the border, if any | D |
| hspace, vspace | For specifying amount of space above and below, and to the sides of an image | D |
| src | For specifying URL of image | |
| usemap | For specifying the image map that should be used with the referenced image | |
| width, height | For specifying size of image so that page is loaded more quickly, or for scaling | |
| input | For creating form elements | |
| accesskey | For adding a keyboard shortcut to a form element | |
| align | For aligning form elements | D |
| checked | For marking a radio button or check box by default | |
| disabled | For graying out form elements until some other event occurs | |
| event | For triggering a script with an event like ONFOCUS, ONBLUR, etc. | |
| maxlength | For determining maximum amount of characters that can be entered in form element | |
| name | For identifying data collected by this element | |
| size | For specifying width of text or password box | |
| src | For specifying URL of active image | |
| readonly | For keeping visitors from changing certain form elements | |
| tabindex | For specifying the order in which the Tab key should take a visitor through the links and form elements | |
| type | For determining type of form element | |
| value | For specifying initial value of form element | |
| ins | For marking inserted text with an underline | |
| kbd | For marking keyboard text | |
| label | For labeling form elements | |
| for | For specifying which form element the label belongs to | |
| layer | For positioning elements | N |
| legend | For labeling fieldsets | |
| align | For aligning legends | D |
| li | For creating a list item | |
| type | For determining which symbols should begin the list item | D |
| value | For determining the initial value of the first list item | D |
| link | For linking to an external style sheet | |
| href | For specifying the URL of the style sheet | |
| media | For noting a style sheet’s purpose | |
| title | For labeling alternate style sheets | |
| type | For noting a style sheet’s MIME type | |
| rel | For indicating that a style sheet is primary or alternate | |
| map | For creating a client-side image map | |
| name | For naming map so it can be referenced later | |
| marquee | For creating moving text | IE |
| behavior | For controlling how the text should move (scroll, slide, alternate) | IE |
| direction | For controlling if the text moves from left to right or right to left | IE |
| loop | For specifying repetitions | IE |
| scrollamount | For specifying amount of space between each marquee repetition | IE |
| scrolldelay | For specifying amount of time between each marquee repetition | IE |
| meta | ||
| content | For adding extra information about the Web page itself | |
| http-equiv | For creating automatic jumps to other pages, setting the default scripting language, and declaring the character encoding | |
| name | For identifying extra information to the Web page | |
| nobr | For keeping all the enclosed elements on one line | N+IE |
| noframes | For providing alternatives to frames | F |
| noscript | For providing alternatives to scripts | |
| object | For embedding objects in Web pages | |
| align | For aligning objects | D |
| border | For creating (or hiding) a border around an object | D |
| classid | For identifying the kind of object being embedded | |
| codebase | For defining the base URL of the source object | |
| data | For identifying the source of the multimedia file to be embedded | |
| hspace, vspace | For specifying amount of space around an object | D |
| name | For identifying the object | |
| standby | For displaying a message as the object is loading | |
| type | For noting the an object’s MIME type | |
| width, height | For specifying the dimensions of the object’s box | |
| ol | For creating ordered lists | |
| type | For specifying the symbols that should begin each list item | D |
| start | For specifying the initial value of the first list item | D |
| optgroup | For dividing a menu into submenus | |
| disabled | For graying out menu options until some other event occurs | |
| label | For specifying how the option should appear in the menu | |
| option | For creating the individual options in a form menu | |
| disabled | For graying out menu options until some other event occurs | |
| label | For specifying how the option should appear in the menu | |
| selected | For making a menu option be selected by default in a blank form | |
| value | For specifying the initial value of a menu option | |
| p | For creating new paragraphs | |
| align | For aligning paragraphs | D |
| param | For setting properties of an object | |
| name | For identifying the kind of property | |
| value | For setting the value of the named property | |
| pre | For displaying text exactly as it appears in HTML document | |
| q | For quoting short passages of text | |
| cite | For giving the URL of the source of the quote | |
| s | (Same as STRIKE) For displaying text with a line through it | D |
| samp | For displaying sample text–in a monospaced font | |
| script | For adding “automatic” scripts to a page | |
| charset | For specifying the character set an external script is written in | |
| language | For specifying the scripting language the script is written in | D |
| src | For referencing an external script | |
| type | For specifying the scripting language the script is written in | |
| select | For creating menus in forms | |
| disabled | For graying out menu options until some other event occurs | |
| name | For identifying the data collected by the menu | |
| multiple | For allowing users to choose more than one option in the menu | |
| size | For specifying the number of items initially visible in the menu | |
| small | For decreasing the size of text | |
| span | For creating custom character styles | |
| class | For naming individual custom character styles | |
| id | For identifying particular HTML elements | |
| strike | (Same as S) For displaying text with a line through it | D |
| strong | For emphasizing text logically, usually in boldface | |
| style | For adding style sheet information to a page | |
| media | For indicating a style sheet’s purpose | |
| type | For indicating a style sheet’s MIME type | |
| sub | For creating subscripts | |
| sup | For creating superscripts | |
| table | For creating tables | |
| align | For aligning an entire table with respect to the window | D |
| background | For specifying a background image for the table | N+IE |
| bgcolor | For specifying the background color of the table | D |
| border | For specifying the thickness, if any, of the border | |
| bordercolor | For specifying a solid color for the border | IE |
| bordercolordark | For specifying the darker (shaded) color of the border | IE |
| bordercolorlight | For specifying the lighter (highlighted) color of the border | IE |
| cellpadding | For setting the space between a cell’s contents and its borders | |
| cellspacing | For setting the amount of space between cells | |
| frame | For displaying external borders | |
| height | For specifying the height of the table | N+IE |
| rules | For displaying internal borders | |
| width | For specifying the size of the table | |
| tbody | For identifying the body of the table | |
| align, valign | For aligning the contents of the body of the table | |
| td; th | For creating regular and header cells, respectively, in a table | |
| align, valign | For aligning a cell’s contents horizontally or vertically | |
| bgcolor | For changing the background color of a cell | D |
| char | For aligning the contents of a cell with respect to a character | |
| colspan | For spanning a cell across more than one column | |
| nowrap | For keeping a cell’s contents on one line | D |
| rowspan | For spanning a cell across more than one row | |
| width, height | For specifying the size of the cell | D |
| textarea | For creating text block entry areas in a form | |
| accesskey | For adding a keyboard shortcut to a text area | |
| disabled | For graying out a text block until some other event occurs | |
| name | For identifying the data that is gathered with the text block | |
| readonly | For protecting a text area’s contents | |
| rows, cols | For specifying the number of rows and columns in the text block | |
| tfoot, thead | For identifying the footer and header area of a table | |
| align, valign | For aligning the footer or header cells | |
| title | Required. For creating the title of the page in title bar area | |
| tr | For creating rows in a table | |
| align, valign | For aligning contents of row horizontally or vertically | |
| bgcolor | For changing color of entire row | D |
| tt | For displaying text in monospaced font | |
| u | For displaying text with line underneath it | D |
| ul | For creating unordered lists | |
| type | For specifying the markers that should precede each list item | D |
| wbr | For creating discretional line breaks | N+IE |
