HTML 4.01 / XHTML 1.0 Reference
| « W3Schools Home | Next Reference » |
Ordered Alphabetically
DTD: indicates in which HTML 4.01 / XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset
| Tag | Description | DTD |
|---|---|---|
| <!–…–> | Defines a comment | STF |
| <!DOCTYPE> | Defines the document type | STF |
| <a> | Defines an anchor | STF |
| <abbr> | Defines an abbreviation | STF |
| <acronym> | Defines an acronym | STF |
| <address> | Defines contact information for the author/owner of a document | STF |
| <applet> | Deprecated. Defines an embedded applet | TF |
| <area /> | Defines an area inside an image-map | STF |
| <b> | Defines bold text | STF |
| <base /> | Defines a default address or a default target for all links on a page | STF |
| <basefont /> | Deprecated. Defines a default font, color, or size for the text in a page | TF |
| <bdo> | Defines the text direction | STF |
| <big> | Defines big text | STF |
| <blockquote> | Defines a long quotation | STF |
| <body> | Defines the document’s body | STF |
| <br /> | Defines a single line break | STF |
| <button> | Defines a push button | STF |
| <caption> | Defines a table caption | STF |
| <center> | Deprecated. Defines centered text | TF |
| <cite> | Defines a citation | STF |
| <code> | Defines computer code text | STF |
| <col /> | Defines attribute values for one or more columns in a table | STF |
| <colgroup> | Defines a group of columns in a table for formatting | STF |
| <dd> | Defines a description of a term in a definition list | STF |
| <del> | Defines deleted text | STF |
| <dfn> | Defines a definition term | STF |
| <dir> | Deprecated. Defines a directory list | TF |
| <div> | Defines a section in a document | STF |
| <dl> | Defines a definition list | STF |
| <dt> | Defines a term (an item) in a definition list | STF |
| <em> | Defines emphasized text | STF |
| <fieldset> | Defines a border around elements in a form | STF |
| <font> | Deprecated. Defines font, color, and size for text | TF |
| <form> | Defines an HTML form for user input | STF |
| <frame /> | Defines a window (a frame) in a frameset | F |
| <frameset> | Defines a set of frames | F |
| <h1> to <h6> | Defines HTML headings | STF |
| <head> | Defines information about the document | STF |
| <hr /> | Defines a horizontal line | STF |
| <html> | Defines an HTML document | STF |
| <i> | Defines italic text | STF |
| <iframe> | Defines an inline frame | TF |
| <img /> | Defines an image | STF |
| <input /> | Defines an input control | STF |
| <ins> | Defines inserted text | STF |
| <isindex> | Deprecated. Defines a searchable index related to a document | TF |
| <kbd> | Defines keyboard text | STF |
| <label> | Defines a label for an input element | STF |
| <legend> | Defines a caption for a fieldset element | STF |
| <li> | Defines a list item | STF |
| <link /> | Defines the relationship between a document and an external resource | STF |
| <map> | Defines an image-map | STF |
| <menu> | Deprecated. Defines a menu list | TF |
| <meta /> | Defines metadata about an HTML document | STF |
| <noframes> | Defines an alternate content for users that do not support frames | TF |
| <noscript> | Defines an alternate content for users that do not support client-side scripts | STF |
| <object> | Defines an embedded object | STF |
| <ol> | Defines an ordered list | STF |
| <optgroup> | Defines a group of related options in a select list | STF |
| <option> | Defines an option in a select list | STF |
| <p> | Defines a paragraph | STF |
| <param /> | Defines a parameter for an object | STF |
| <pre> | Defines preformatted text | STF |
| <q> | Defines a short quotation | STF |
| <s> | Deprecated. Defines strikethrough text | TF |
| <samp> | Defines sample computer code | STF |
| <script> | Defines a client-side script | STF |
| <select> | Defines a select list (drop-down list) | STF |
| <small> | Defines small text | STF |
| <span> | Defines a section in a document | STF |
| <strike> | Deprecated. Defines strikethrough text | TF |
| <strong> | Defines strong text | STF |
| <style> | Defines style information for a document | STF |
| <sub> | Defines subscripted text | STF |
| <sup> | Defines superscripted text | STF |
| <table> | Defines a table | STF |
| <tbody> | Groups the body content in a table | STF |
| <td> | Defines a cell in a table | STF |
| <textarea> | Defines a multi-line text input control | STF |
| <tfoot> | Groups the footer content in a table | STF |
| <th> | Defines a header cell in a table | STF |
| <thead> | Groups the header content in a table | STF |
| <title> | Defines the title of a document | STF |
| <tr> | Defines a row in a table | STF |
| <tt> | Defines teletype text | STF |
| <u> | Deprecated. Defines underlined text | TF |
| <ul> | Defines an unordered list | STF |
| <var> | Defines a variable part of a text | STF |
| <xmp> | Deprecated. Defines preformatted text |
| « W3Schools Home |
TML 4.01 / XHTML 1.0 Reference
| « Previous | Next Reference » |
Ordered by Function
DTD: indicates in which HTML 4.01 / XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset
| Tag | Description | DTD |
|---|---|---|
| Basic | ||
| <!DOCTYPE> | Defines the document type | STF |
| <html> | Defines an HTML document | STF |
| <body> | Defines the document’s body | STF |
| <h1> to <h6> | Defines HTML headings | STF |
| <p> | Defines a paragraph | STF |
| <br /> | Inserts a single line break | STF |
| <hr /> | Defines a horizontal line | STF |
| <!–…–> | Defines a comment | STF |
| Formatting | ||
| <acronym> | Defines an acronym | STF |
| <abbr> | Defines an abbreviation | STF |
| <address> | Defines contact information for the author/owner of a document | STF |
| <b> | Defines bold text | STF |
| <bdo> | Defines the text direction | STF |
| <big> | Defines big text | STF |
| <blockquote> | Defines a long quotation | STF |
| <center> | Deprecated. Defines centered text | TF |
| <cite> | Defines a citation | STF |
| <code> | Defines computer code text | STF |
| <del> | Defines deleted text | STF |
| <dfn> | Defines a definition term | STF |
| <em> | Defines emphasized text | STF |
| <font> | Deprecated. Defines font, color, and size for text | TF |
| <i> | Defines italic text | STF |
| <ins> | Defines inserted text | STF |
| <kbd> | Defines keyboard text | STF |
| <pre> | Defines preformatted text | STF |
| <q> | Defines a short quotation | STF |
| <s> | Deprecated. Defines strikethrough text | TF |
| <samp> | Defines sample computer code | STF |
| <small> | Defines small text | STF |
| <strike> | Deprecated. Defines strikethrough text | TF |
| <strong> | Defines strong text | STF |
| <sub> | Defines subscripted text | STF |
| <sup> | Defines superscripted text | STF |
| <tt> | Defines teletype text | STF |
| <u> | Deprecated. Defines underlined text | TF |
| <var> | Defines a variable part of a text | STF |
| <xmp> | Deprecated. Defines preformatted text | |
| Forms | ||
| <form> | Defines an HTML form for user input | STF |
| <input /> | Defines an input control | STF |
| <textarea> | Defines a multi-line text input control | STF |
| <button> | Defines a push button | STF |
| <select> | Defines a select list (drop-down list) | STF |
| <optgroup> | Defines a group of related options in a select list | STF |
| <option> | Defines an option in a select list | STF |
| <label> | Defines a label for an input element | STF |
| <fieldset> | Defines a border around elements in a form | STF |
| <legend> | Defines a caption for a fieldset element | STF |
| <isindex> | Deprecated. Defines a searchable index related to a document | TF |
| Frames | ||
| <frame /> | Defines a window (a frame) in a frameset | F |
| <frameset> | Defines a set of frames | F |
| <noframes> | Defines an alternate content for users that do not support frames | TF |
| <iframe> | Defines an inline frame | TF |
| Images | ||
| <img /> | Defines an image | STF |
| <map> | Defines an image-map | STF |
| <area /> | Defines an area inside an image-map | STF |
| Links | ||
| <a> | Defines an anchor | STF |
| <link /> | Defines the relationship between a document and an external resource | STF |
| Lists | ||
| <ul> | Defines an unordered list | STF |
| <ol> | Defines an ordered list | STF |
| <li> | Defines a list item | STF |
| <dir> | Deprecated. Defines a directory list | TF |
| <dl> | Defines a definition list | STF |
| <dt> | Defines a term (an item) in a definition list | STF |
| <dd> | Defines a description of a term in a definition list | STF |
| <menu> | Deprecated. Defines a menu list | TF |
| Tables | ||
| <table> | Defines a table | STF |
| <caption> | Defines a table caption | STF |
| <th> | Defines a header cell in a table | STF |
| <tr> | Defines a row in a table | STF |
| <td> | Defines a cell in a table | STF |
| <thead> | Groups the header content in a table | STF |
| <tbody> | Groups the body content in a table | STF |
| <tfoot> | Groups the footer content in a table | STF |
| <col /> | Defines attribute values for one or more columns in a table | STF |
| <colgroup> | Defines a group of columns in a table for formatting | STF |
| Styles | ||
| <style> | Defines style information for a document | STF |
| <div> | Defines a section in a document | STF |
| <span> | Defines a section in a document | STF |
| Meta Info | ||
| <head> | Defines information about the document | STF |
| <title> | Defines the document title | STF |
| <meta> | Defines metadata about an HTML document | STF |
| <base /> | Defines a default address or a default target for all links on a page | STF |
| <basefont /> | Deprecated. Defines a default font, color, or size for the text in a page | TF |
| Programming | ||
| <script> | Defines a client-side script | STF |
| <noscript> | Defines an alternate content for users that do not support client-side scripts | STF |
| <applet> | Deprecated. Defines an embedded applet | TF |
| <object> | Defines an embedded object | STF |
| <param /> | Defines a parameter for an object | STF |
| « Previous |
TML / XHTML Standard Attributes
| « Previous | Next Reference » |
The attributes listed below are standard, and are supported by all HTML and XHTML tags, with a few exceptions.
Core Attributes
Not valid in base, head, html, meta, param, script, style, and title elements.
| Attribute | Value | Description |
|---|---|---|
| class | classname | Specifies a classname for an element |
| id | id | Specifies a unique id for an element |
| style | style_definition | Specifies an inline style for an element |
| title | text | Specifies extra information about an element |
Language Attributes
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements.
| Attribute | Value | Description |
|---|---|---|
| dir | ltr rtl |
Specifies the text direction for the content in an element |
| lang | language_code | Specifies a language code for the content in an element. Language code reference |
| xml:lang | language_code | Specifies a language code for the content in an element, in XHTML documents. Language code reference |
Keyboard Attributes
| Attribute | Value | Description |
|---|---|---|
| accesskey | character | Specifies a keyboard shortcut to access an element |
| tabindex | number | Specifies the tab order of an element |
| « Previous |
TML / XHTML Standard Event Attributes
| « Previous | Next Reference » |
Standard Event Attributes
HTML 4 added the ability to let events trigger actions in a browser, like starting a JavaScript when a user clicks on an element.
To learn more about programming events, please visit our JavaScript tutorial and our DHTML tutorial.
Below is the standard event attributes that can be inserted into HTML / XHTML elements to define event actions.
<body> and <frameset> Events
The two attributes below can only be used in <body> or <frameset>:
| Attribute | Value | Description |
|---|---|---|
| onload | script | Script to be run when a document load |
| onunload | script | Script to be run when a document unload |
Form Events
The attributes below can be used in form elements:
| Attribute | Value | Description |
|---|---|---|
| onblur | script | Script to be run when an element loses focus |
| onchange | script | Script to be run when an element changes |
| onfocus | script | Script to be run when an element gets focus |
| onreset | script | Script to be run when a form is reset |
| onselect | script | Script to be run when an element is selected |
| onsubmit | script | Script to be run when a form is submitted |
Image Events
The attribute below can be used with the img element:
| Attribute | Value | Description |
|---|---|---|
| onabort | script | Script to be run when loading of an image is interrupted |
Keyboard Events
Valid in all elements except base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title.
| Attribute | Value | Description |
|---|---|---|
| onkeydown | script | Script to be run when a key is pressed |
| onkeypress | script | Script to be run when a key is pressed and released |
| onkeyup | script | Script to be run when a key is released |
Mouse Events
Valid in all elements except base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title.
| Attribute | Value | Description |
|---|---|---|
| onclick | script | Script to be run on a mouse click |
| ondblclick | script | Script to be run on a mouse double-click |
| onmousedown | script | Script to be run when mouse button is pressed |
| onmousemove | script | Script to be run when mouse pointer moves |
| onmouseout | script | Script to be run when mouse pointer moves out of an element |
| onmouseover | script | Script to be run when mouse pointer moves over an element |
| onmouseup | script | Script to be run when mouse button is released |
| « Previous |