This section is non-normative.
An asterisk (*) in a cell indicates that the actual rules are more complicated than indicated in the table above.
† Categories in the "Parents" column refer to parents that list
the given categories in their content model, not to elements that themselves are in those
categories. For example, the a element's "Parents" column says "phrasing", so any
element whose content model contains the "phrasing" category could be a parent of an
a element. Since the "flow" category includes all the "phrasing" elements, that means
the th element could be a parent to an a element.
This section is non-normative.
* The tabindex attribute can also
make any element into interactive content.
This section is non-normative.
| Attribute | Element(s) | Description | Value |
|---|---|---|---|
abbr
| th
| Alternative label to use for the header cell when referencing the cell in other contexts | Text* |
accept
| input
| Hint for expected file type in file upload controls | Set of comma-separated tokens* consisting of valid MIME types with no parameters or audio/*, video/*, or image/*
|
accept-charset
| form
| Character encodings to use for form submission | Ordered set of unique space-separated tokens, ASCII case-insensitive, consisting of labels of ASCII-compatible encodings* |
accesskey
| HTML elements | Keyboard shortcut to activate or focus element | Ordered set of unique space-separated tokens, case-sensitive, consisting of one Unicode code point in length |
action
| form
| URL to use for form submission | Valid non-empty URL potentially surrounded by spaces |
allowfullscreen
| iframe
| Whether to allow the iframe's contents to use requestFullscreen()
| Boolean attribute |
alt
| area;
img;
input
| Replacement text for use when images are not available | Text* |
async
| script
| Execute script when available, without blocking | Boolean attribute |
autocomplete
| form
| Default setting for autofill feature for controls in the form | "on"; "off"
|
autocomplete
| input;
select;
textarea
| Hint for form autofill feature | Autofill field name and related tokens* |
autofocus
| button;
input;
keygen;
select;
textarea
| Automatically focus the form control when the page is loaded | Boolean attribute |
autoplay
| audio;
video
| Hint that the media resource can be started automatically when the page is loaded | Boolean attribute |
challenge
| keygen
| String to package with the generated and signed public key | Text |
charset
| meta
| Character encoding declaration | Encoding label* |
charset
| script
| Character encoding of the external script resource | Encoding label* |
checked
| menuitem;
input
| Whether the command or control is checked | Boolean attribute |
cite
| blockquote;
del;
ins;
q
| Link to the source of the quotation or more information about the edit | Valid URL potentially surrounded by spaces |
class
| HTML elements | Classes to which the element belongs | Set of space-separated tokens |
cols
| textarea
| Maximum number of characters per line | Valid non-negative integer greater than zero |
colspan
| td;
th
| Number of columns that the cell is to span | Valid non-negative integer greater than zero |
command
| menuitem
| Command definition | ID* |
content
| meta
| Value of the element | Text* |
contenteditable
| HTML elements | Whether the element is editable | "true"; "false"
|
contextmenu
| HTML elements | The element's context menu | ID* |
controls
| audio;
video
| Show user agent controls | Boolean attribute |
coords
| area
| Coordinates for the shape to be created in an image map | Valid list of integers* |
crossorigin
| audio;
img;
link;
script;
video
| How the element handles crossorigin requests | "anonymous"; "use-credentials"
|
data
| object
| Address of the resource | Valid non-empty URL potentially surrounded by spaces |
datetime
| del;
ins
| Date and (optionally) time of the change | Valid date string with optional time |
datetime
| time
| Machine-readable value | Valid month string, valid date string, valid yearless date string, valid time string, valid local date and time string, valid time-zone offset string, valid global date and time string, valid week string, valid non-negative integer, or valid duration string |
default
| menuitem
| Mark the command as being a default command | Boolean attribute |
default
| track
| Enable the track if no other text track is more suitable | Boolean attribute |
defer
| script
| Defer script execution | Boolean attribute |
dir
| HTML elements | The text directionality of the element | "ltr"; "rtl"; "auto"
|
dir
| bdo
| The text directionality of the element | "ltr"; "rtl"
|
dirname
| input;
textarea
| Name of form field to use for sending the element's directionality in form submission | Text* |
disabled
| button;
menuitem;
fieldset;
input;
keygen;
optgroup;
option;
select;
textarea
| Whether the form control is disabled | Boolean attribute |
download
| a;
area
| Whether to download the resource instead of navigating to it, and its file name if so | Text |
draggable
| HTML elements | Whether the element is draggable | "true"; "false"
|
dropzone
| HTML elements | Accepted item types for drag-and-drop | Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of accepted types and drag feedback* |
enctype
| form
| Form data set encoding type to use for form submission | "application/x-www-form-urlencoded"; "multipart/form-data"; "text/plain"
|
for
| label
| Associate the label with form control | ID* |
for
| output
| Specifies controls from which the output was calculated | Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs* |
form
| button;
fieldset;
input;
keygen;
label;
object;
output;
select;
textarea
| Associates the control with a form element
| ID* |
formaction
| button;
input
| URL to use for form submission | Valid non-empty URL potentially surrounded by spaces |
formenctype
| button;
input
| Form data set encoding type to use for form submission | "application/x-www-form-urlencoded"; "multipart/form-data"; "text/plain"
|
formmethod
| button;
input
| HTTP method to use for form submission | "GET"; "POST"
|
formnovalidate
| button;
input
| Bypass form control validation for form submission | Boolean attribute |
formtarget
| button;
input
| Browsing context for form submission | Valid browsing context name or keyword |
headers
| td;
th
| The header cells for this cell | Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs* |
height
| canvas;
embed;
iframe;
img;
input;
object;
video
| Vertical dimension | Valid non-negative integer |
hidden
| Whether the element is relevant | Boolean attribute | |
high
| meter
| Low limit of high range | Valid floating-point number* |
href
| a;
area
| Address of the hyperlink | Valid URL potentially surrounded by spaces |
href
| link
| Address of the hyperlink | Valid non-empty URL potentially surrounded by spaces |
href
| base
| Document base URL | Valid URL potentially surrounded by spaces |
hreflang
| a;
area;
link
| Language of the linked resource | Valid BCP 47 language tag |
http-equiv
| meta
| Pragma directive | Text* |
icon
| menuitem
| Icon for the command | Valid non-empty URL potentially surrounded by spaces |
id
| HTML elements | The element's ID | Text* |
inputmode
| input;
textarea
| Hint for selecting an input modality | "verbatim";
"latin";
"latin-name";
"latin-prose";
"full-width-latin";
"kana";
"kana-name";
"katakana";
"numeric";
"tel";
"email";
"url"
|
ismap
| img
| Whether the image is a server-side image map | Boolean attribute |
itemid
| HTML elements | Global identifier for a microdata item | Valid URL potentially surrounded by spaces |
itemprop
| HTML elements | Property names of a microdata item | Unordered set of unique space-separated tokens, case-sensitive, consisting of valid absolute URLs, defined property names, or text* |
itemref
| HTML elements | Referenced elements | Unordered set of unique space-separated tokens, case-sensitive, consisting of IDs* |
itemscope
| HTML elements | Introduces a microdata item | Boolean attribute |
itemtype
| HTML elements | Item types of a microdata item | Unordered set of unique space-separated tokens, case-sensitive, consisting of valid absolute URL* |
keytype
| keygen
| The type of cryptographic key to generate | Text* |
kind
| track
| The type of text track | "subtitles";
"captions";
"descriptions";
"chapters";
"metadata"
|
label
| menuitem;
menu;
optgroup;
option;
track
| User-visible label | Text |
lang
| HTML elements | Language of the element | Valid BCP 47 language tag or the empty string |
list
| input
| List of autocomplete options | ID* |
loop
| audio;
video
| Whether to loop the media resource | Boolean attribute |
low
| meter
| High limit of low range | Valid floating-point number* |
manifest
| html
| Application cache manifest | Valid non-empty URL potentially surrounded by spaces |
max
| input
| Maximum value | Varies* |
max
| meter;
progress
| Upper bound of range | Valid floating-point number* |
maxlength
| input;
textarea
| Maximum length of value | Valid non-negative integer |
media
| link;
style
| Applicable media | Valid media query list |
mediagroup
| audio;
video
| Groups media elements together with an implicit MediaController
| Text |
menu
| button
| Specifies the element's designated pop-up menu | ID* |
method
| form
| HTTP method to use for form submission | "GET";
"POST";
"dialog"
|
min
| input
| Minimum value | Varies* |
min
| meter
| Lower bound of range | Valid floating-point number* |
minlength
| input;
textarea
| Minimum length of value | Valid non-negative integer |
multiple
| input;
select
| Whether to allow multiple values | Boolean attribute |
muted
| audio;
video
| Whether to mute the media resource by default | Boolean attribute |
name
| button;
fieldset;
input;
keygen;
output;
select;
textarea
| Name of form control to use for form submission and in the form.elements API
| Text* |
name
| form
| Name of form to use in the document.forms API
| Text* |
name
| iframe;
object
| Name of nested browsing context | Valid browsing context name or keyword |
name
| map
| Name of image map to reference from the usemap attribute
| Text* |
name
| meta
| Metadata name | Text* |
name
| param
| Name of parameter | Text |
nonce
| script;
style
| Cryptographic nonce used in Content Security Policy checks [CSP] | Text |
novalidate
| form
| Bypass form control validation for form submission | Boolean attribute |
open
| details
| Whether the details are visible | Boolean attribute |
open
| dialog
| Whether the dialog box is showing | Boolean attribute |
optimum
| meter
| Optimum value in gauge | Valid floating-point number* |
pattern
| input
| Pattern to be matched by the form control's value | Regular expression matching the JavaScript Pattern production |
placeholder
| input;
textarea
| User-visible label to be placed within the form control | Text* |
poster
| video
| Poster frame to show prior to video playback | Valid non-empty URL potentially surrounded by spaces |
preload
| audio;
video
| Hints how much buffering the media resource will likely need | "none";
"metadata";
"auto"
|
radiogroup
| menuitem
| Name of group of commands to treat as a radio button group | Text |
readonly
| input;
textarea
| Whether to allow the value to be edited by the user | Boolean attribute |
rel
| a;
area;
link
| Relationship between the document containing the hyperlink and the destination resource | Set of space-separated tokens* |
required
| input;
select;
textarea
| Whether the control is required for form submission | Boolean attribute |
reversed
| ol
| Number the list backwards | Boolean attribute |
rows
| textarea
| Number of lines to show | Valid non-negative integer greater than zero |
rowspan
| td;
th
| Number of rows that the cell is to span | Valid non-negative integer |
sandbox
| iframe
| Security rules for nested content | Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of
"allow-forms",
"allow-modals",
"allow-pointer-lock",
"allow-popups",
"allow-popups-to-escape-sandbox",
"allow-same-origin",
"allow-scripts and
"allow-top-navigation"
|
spellcheck
| HTML elements | Whether the element is to have its spelling and grammar checked | "true"; "false"
|
scope
| th
| Specifies which cells the header cell applies to | "row";
"col";
"rowgroup";
"colgroup"
|
scoped
| style
| Whether the styles apply to the entire document or just the parent subtree | Boolean attribute |
seamless
| iframe
| Whether to apply the document's styles to the nested content | Boolean attribute |
selected
| option
| Whether the option is selected by default | Boolean attribute |
shape
| area
| The kind of shape to be created in an image map | "circle";
"default";
"poly";
"rect"
|
size
| input;
select
| Size of the control | Valid non-negative integer greater than zero |
sizes
| link
| Sizes of the icons (for rel="icon")
| Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of sizes* |
sortable
| table
| Enables a sorting interface for the table | Boolean attribute |
sorted
| th
| Column sort direction and ordinality | Set of space-separated tokens, ASCII case-insensitive, consisting of neither, one, or both of "reversed" and a valid non-negative integer greater than zero
|
span
| col;
colgroup
| Number of columns spanned by the element | Valid non-negative integer greater than zero |
src
| audio;
embed;
iframe;
img;
input;
script;
source;
track;
video
| Address of the resource | Valid non-empty URL potentially surrounded by spaces |
srcdoc
| iframe
| A document to render in the iframe
| The source of an iframe srcdoc document*
|
srclang
| track
| Language of the text track | Valid BCP 47 language tag |
srcset
| img
| Images to use in different situations (e.g. high-resolution displays, small monitors, etc) | Comma-separated list of image candidate strings |
start
| ol
| Ordinal value of the first item | Valid integer |
step
| input
| Granularity to be matched by the form control's value | Valid floating-point number greater than zero, or "any"
|
style
| HTML elements | Presentational and formatting instructions | CSS declarations* |
tabindex
| HTML elements | Whether the element is focusable, and the relative order of the element for the purposes of sequential focus navigation | Valid integer |
target
| a;
area
| Browsing context for hyperlink navigation | Valid browsing context name or keyword |
target
| base
| Default browsing context for hyperlink navigation and form submission | Valid browsing context name or keyword |
target
| form
| Browsing context for form submission | Valid browsing context name or keyword |
title
| HTML elements | Advisory information for the element | Text |
title
| abbr;
dfn
| Full term or expansion of abbreviation | Text |
title
| input
| Description of pattern (when used with pattern attribute)
| Text |
title
| menuitem
| Hint describing the command | Text |
title
| link
| Title of the link | Text |
title
| link;
style
| Alternative style sheet set name | Text |
translate
| HTML elements | Whether the element is to be translated when the page is localized | "yes"; "no"
|
type
| a;
area;
link
| Hint for the type of the referenced resource | Valid MIME type |
type
| button
| Type of button | "submit";
"reset";
"button";
"menu"
|
type
| embed;
object;
script;
source;
style
| Type of embedded resource | Valid MIME type |
type
| input
| Type of form control | input type keyword
|
type
| menu
| Type of menu | "popup"; "toolbar"
|
type
| menuitem
| Type of command | "command";
"checkbox";
"radio"
|
type
| ol
| Kind of list marker | "1";
"a";
"A";
"i";
"I"
|
typemustmatch
| object
| Whether the type attribute and the Content-Type value need to match for the resource to be used
| Boolean attribute |
usemap
| img;
object
| Name of image map to use | Valid hash-name reference* |
value
| button;
option
| Value to be used for form submission | Text |
value
| data
| Machine-readable value | Text* |
value
| input
| Value of the form control | Varies* |
value
| li
| Ordinal value of the list item | Valid integer |
value
| meter;
progress
| Current value of the element | Valid floating-point number |
value
| param
| Value of parameter | Text |
width
| canvas;
embed;
iframe;
img;
input;
object;
video
| Horizontal dimension | Valid non-negative integer |
wrap
| textarea
| How the value of the form control is to be wrapped for form submission | "soft";
"hard"
|
An asterisk (*) in a cell indicates that the actual rules are more complicated than indicated in the table above.
Document objects, and Window objectsThe following are the event handlers (and their corresponding event handler event types) that must be
supported by all HTML elements, as both event handler content attributes
and event handler IDL attributes; and that must be
supported by all Document and Window objects, as event handler IDL
attributes:
| Event handler | Event handler event type |
|---|---|
onabort | abort
|
onautocomplete | autocomplete
|
onautocompleteerror | autocompleteerror
|
oncancel | cancel
|
oncanplay | canplay
|
oncanplaythrough | canplaythrough
|
onchange | change
|
onclick | click
|
onclose | close
|
oncontextmenu | contextmenu
|
oncuechange | cuechange
|
ondblclick | dblclick
|
ondrag | drag
|
ondragend | dragend
|
ondragenter | dragenter
|
ondragexit | dragexit
|
ondragleave | dragleave
|
ondragover | dragover
|
ondragstart | dragstart
|
ondrop | drop
|
ondurationchange | durationchange
|
onemptied | emptied
|
onended | ended
|
oninput | input
|
oninvalid | invalid
|
onkeydown | keydown
|
onkeypress | keypress
|
onkeyup | keyup
|
onloadeddata | loadeddata
|
onloadedmetadata | loadedmetadata
|
onloadstart | loadstart
|
onmousedown | mousedown
|
onmouseenter | mouseenter
|
onmouseleave | mouseleave
|
onmousemove | mousemove
|
onmouseout | mouseout
|
onmouseover | mouseover
|
onmouseup | mouseup
|
onwheel | wheel
|
onpause | pause
|
onplay | play
|
onplaying | playing
|
onprogress | progress
|
onratechange | ratechange
|
onreset | reset
|
onseeked | seeked
|
onseeking | seeking
|
onselect | select
|
onshow | show
|
onsort | sort
|
onstalled | stalled
|
onsubmit | submit
|
onsuspend | suspend
|
ontimeupdate | timeupdate
|
ontoggle | toggle
|
onvolumechange | volumechange
|
onwaiting | waiting
|
The following are the event handlers (and their corresponding event handler event types) that must be
supported by all HTML elements other than body and frameset
elements, as both event handler content attributes and event handler IDL
attributes; that must be supported by all Document
objects, as event handler IDL attributes; and that must be
supported by all Window objects, as event handler IDL attributes on the
Window objects themselves, and with corresponding event handler content
attributes and event handler IDL attributes exposed on all body
and frameset elements that are owned by that
Window object's Documents:
| Event handler | Event handler event type |
|---|---|
onblur | blur
|
onerror | error
|
onfocus | focus
|
onload | load
|
onresize | resize
|
onscroll | scroll
|
The following are the event handlers (and their corresponding event handler event types) that must be
supported by Window objects, as event handler IDL attributes on the
Window objects themselves, and with corresponding event handler content
attributes and event handler IDL attributes exposed on all body
and frameset elements that are owned by that
Window object's Documents:
| Event handler | Event handler event type |
|---|---|
onafterprint | afterprint
|
onbeforeprint | beforeprint
|
onbeforeunload | beforeunload
|
onhashchange | hashchange
|
onlanguagechange | languagechange
|
onmessage | message
|
onoffline | offline
|
ononline | online
|
onpagehide | pagehide
|
onpageshow | pageshow
|
onpopstate | popstate
|
onstorage | storage
|
onunload | unload
|
The following are the event handlers (and their corresponding event handler event types) that must be
supported on Document objects as event handler IDL attributes:
| Event handler | Event handler event type |
|---|---|
onreadystatechange | readystatechange
|
[NoInterfaceObject]
interface GlobalEventHandlers {
attribute EventHandler onabort;
attribute EventHandler onautocomplete;
attribute EventHandler onautocompleteerror;
attribute EventHandler onblur;
attribute EventHandler oncancel;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
attribute EventHandler onclick;
attribute EventHandler onclose;
attribute EventHandler oncontextmenu;
attribute EventHandler oncuechange;
attribute EventHandler ondblclick;
attribute EventHandler ondrag;
attribute EventHandler ondragend;
attribute EventHandler ondragenter;
attribute EventHandler ondragexit;
attribute EventHandler ondragleave;
attribute EventHandler ondragover;
attribute EventHandler ondragstart;
attribute EventHandler ondrop;
attribute EventHandler ondurationchange;
attribute EventHandler onemptied;
attribute EventHandler onended;
attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
attribute EventHandler oninput;
attribute EventHandler oninvalid;
attribute EventHandler onkeydown;
attribute EventHandler onkeypress;
attribute EventHandler onkeyup;
attribute EventHandler onload;
attribute EventHandler onloadeddata;
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
[LenientThis] attribute EventHandler onmouseenter;
[LenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
attribute EventHandler onmouseup;
attribute EventHandler onwheel;
attribute EventHandler onpause;
attribute EventHandler onplay;
attribute EventHandler onplaying;
attribute EventHandler onprogress;
attribute EventHandler onratechange;
attribute EventHandler onreset;
attribute EventHandler onresize;
attribute EventHandler onscroll;
attribute EventHandler onseeked;
attribute EventHandler onseeking;
attribute EventHandler onselect;
attribute EventHandler onshow;
attribute EventHandler onsort;
attribute EventHandler onstalled;
attribute EventHandler onsubmit;
attribute EventHandler onsuspend;
attribute EventHandler ontimeupdate;
attribute EventHandler ontoggle;
attribute EventHandler onvolumechange;
attribute EventHandler onwaiting;
};
[NoInterfaceObject]
interface WindowEventHandlers {
attribute EventHandler onafterprint;
attribute EventHandler onbeforeprint;
attribute OnBeforeUnloadEventHandler onbeforeunload;
attribute EventHandler onhashchange;
attribute EventHandler onlanguagechange;
attribute EventHandler onmessage;
attribute EventHandler onoffline;
attribute EventHandler ononline;
attribute EventHandler onpagehide;
attribute EventHandler onpageshow;
attribute EventHandler onpopstate;
attribute EventHandler onstorage;
attribute EventHandler onunload;
};This section is non-normative.
The following MIME types are mentioned in this specification:
application/atom+xmlapplication/ecmascriptapplication/javascriptapplication/jsonapplication/x-ecmascriptapplication/x-javascriptapplication/octet-streamapplication/microdata+jsonapplication/rss+xmlapplication/x-www-form-urlencodedapplication/xhtml+xmlapplication/xmlimage/gifimage/jpegimage/pngimage/svg+xmlmultipart/form-datamultipart/mixedmultipart/x-mixed-replacetext/cache-manifesttext/csstext/ecmascripttext/event-streamtext/javascripttext/javascript1.0text/javascript1.1text/javascript1.2text/javascript1.3text/javascript1.4text/javascript1.5text/jscripttext/jsontext/livescripttext/plaintext/htmltext/uri-listtext/vcardtext/vtttext/x-ecmascripttext/x-javascripttext/xmlvideo/mp4video/mpegAll references are normative unless marked "Non-normative".
XMLHttpRequest, A. van Kesteren. WHATWG.The following attributes are common to and may be specified on all HTML elements (even those not defined in this specification):
accesskeyclasscontenteditablecontextmenudirdraggabledropzoneiditemiditempropitemrefitemscopeitemtypelangspellcheckstyletabindextitletranslateThe following event handler content attributes may be specified on any HTML element:
onabortonautocompleteonautocompleteerroronblur*oncanceloncanplayoncanplaythroughonchangeonclickoncloseoncontextmenuoncuechangeondblclickondragondragendondragenterondragexitondragleaveondragoverondragstartondropondurationchangeonemptiedonendedonerror*onfocus*oninputoninvalidonkeydownonkeypressonkeyuponload*onloadeddataonloadedmetadataonloadstartonmousedownonmouseenteronmouseleaveonmousemoveonmouseoutonmouseoveronmouseuponwheelonpauseonplayonplayingonprogressonratechangeonresetonresize*onscroll*onseekedonseekingonselectonshowonsortonstalledonsubmitonsuspendontimeupdateontoggleonvolumechangeonwaiting