Attributes

This section is non-normative.
List of attributes (excluding event handler content attributes)
Attribute Element(s) Description Value
<{abbr}> <{th}> Alternative label to use for the header cell when referencing the cell in other contexts Text*
<{input/accept}> <{input}> Hint for expected file type in <{input/File|File Upload}> controls Set of comma-separated tokens* consisting of valid MIME types with no parameters or audio/*, video/*, or image/*
<{form/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*
<{global/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
<{form/action}> <{form}> [=url/URL=] to use for form submission Valid non-empty URL potentially surrounded by spaces
<{iframe/allowfullscreen}> <{iframe}> Whether to allow the <{iframe}>'s contents to use {{Element/requestFullscreen()}} Boolean attribute
<{iframe/allowpaymentrequest}> <{iframe}> Whether to allow the <{iframe}>'s browsing context to use the PaymentRequest interface to make payment requests. Boolean attribute
<{iframe/allowusermedia}> <{iframe}> Whether to allow the <{iframe}>'s browsing context to use {{Element/getUserMedia()}}. Boolean attribute
alt <{area}>; <{img}>; <{input}> Replacement text for use when images are not available Text*
<{script/async}> <{script}> Execute script asynchronously Boolean attribute
<{input/autocapitalize}> <{input}>; <{textarea}> Hint for the capitalization of the inputted text "sentences"; "words"; "characters"
<{form/autocomplete}> <{form}> Default setting for autofill feature for controls in the form "on"; "off"
<{input/autocomplete}> <{input}>; <{select}>; <{textarea}> Hint for form autofill feature Autofill field name and related tokens*
<{formelements/autofocus}> <{button}>; <{input}>; <{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
border <{table}> Explicit indication that the <{table}> element is not being used for layout purposes The empty string, or "1"
charset <{meta}> Character encoding declaration utf-8
charset <{script}> Character encoding of the external script resource utf-8
checked <{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
content <{meta}> Value of the element Text*
contenteditable HTML elements Whether the element is editable "true"; "false"
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 floating-point numbers*
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 floating 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
<{img/decoding}> <{img}> A hint to request a/synchronous loading of images "sync", "async", "auto"
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}>; <{fieldset}>; <{input}>; <{optgroup}>; <{option}>; <{select}>; <{textarea}> Whether the form control is disabled Boolean attribute
<{media/disableRemotePlayback}> <{audio}>; <{video}> Whether the remote playback of a media element is disabled Boolean attribute
download <{a}>; <{area}> Whether to download the resource instead of navigating to it, and its file name if so Text
<{global/draggable}> HTML elements Whether the element is draggable "true"; "false"
<{form/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}>; <{label}>; <{object}>; <{output}>; <{select}>; <{textarea}> Associates the control with a <{form}> element ID*
formaction <{button}>; <{input}> [=url/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
<{global/hidden}> HTML elements 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*
id HTML elements The element's ID Text*
integrity <{link}>; <{script}> Integrity metadata used in Subresource Integrity checks [[!SRI]] Text
<{global/is}> Customized built-in elements The local name of the element A valid custom element name
ismap <{img}> Whether the image is a server-side image map Boolean attribute
kind <{track}> The type of text track "subtitles"; "captions"; "descriptions"; "chapters"; "metadata"
label <{optgroup}>; <{option}>; <{track}> User-visible label Text
lang HTML elements Language of the element Valid BCP 47 language tag or the empty string
<{input/list}> <{input}> List of autocomplete options ID*
longdesc <{img}> A link to a fuller description of the image Valid non-empty URL potentially surrounded by spaces
loop <{audio}>; <{video}> Whether to loop the media resource Boolean attribute
low <{meter}> High limit of low range Valid floating-point number*
<{html/manifest}> <{html}> Application cache manifest a valid non-empty URL potentially surrounded by spaces
<{input/max}> <{input}> Maximum value Varies*
<{meter/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
<{form/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}>; <{output}>; <{select}>; <{textarea}> Name of form control to use for form submission and in the {{HTMLFormElement/elements|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 HTML elements Cryptographic nonce used in Content Security Policy checks [[CSP3]] Text
<{form/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
ping <{a}>, <{area}> URLs to ping Set of comma-separated tokens consisting of valid non-empty URLs
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"
readonly <{input}>; <{textarea}> Whether to allow the value to be edited by the user Boolean attribute
referrerpolicy <{a}>; <{area}>; <{iframe}>; <{img}>; <{link}> Referrer policy for fetches initiated by the element Referrer policy
<{links/rel}> <{a}>; <{area}>; <{link}> Relationship of this document (or subsection/topic) to the destination resource Set of space-separated tokens*
required <{input}>; <{select}>; <{textarea}> Whether the control is required for form submission Boolean attribute
<{links/rev}> <{a}>; <{link}> Reverse link relationship of the destination resource to this document (or subsection/topic) Set of space-separated tokens
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
<{iframe/sandbox}> <{iframe}> Security rules for nested content Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of "allow-forms", "allow-pointer-lock", "allow-popups", "allow-presentation", "allow-same-origin", "allow-scripts and "allow-top-navigation"
scope <{th}> Specifies which cells the header cell applies to "row"; "col"; "rowgroup"; "colgroup"
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 <{link/rel}>="icon") Unordered set of unique space-separated tokens, ASCII case-insensitive, consisting of sizes*
sizes <{img}>; <{source}> Image sizes for different page layouts Valid source size list
span <{col}>; <{colgroup}> Number of columns spanned by the element Valid non-negative integer greater than zero
<{global/spellcheck}> HTML elements Whether the element is to have its spelling and grammar checked "true"; "false"
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}>; <{source}> 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
<{input/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*
<{global/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
<{base/target}> <{base}> Default browsing context for hyperlink navigation and form submission Valid browsing context name or keyword
<{form/target}> <{form}> Browsing context for form submission Valid browsing context name or keyword
<{global/title}> HTML elements Advisory information for the element Text
<{abbr/title}> <{abbr}>; <{dfn}> Full term or expansion of abbreviation Text
<{input/title}> <{input}> Description of pattern (when used with pattern attribute) Text
<{link/title}> <{link}> Title of the link Text
title <{link/title|link}>; <{style/title|style}> Alternative style sheet set name Text
<{global/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
<{button/type}> <{button}> Type of button "submit"; "reset"; "button"
type <{embed}>; <{object}>; <{script}>; <{source}>; <{style}> Type of embedded resource Valid MIME type
type <{input}> Type of form control input type keyword
type <{ol}> Kind of list marker "1"; "a"; "A"; "i"; "I"
typemustmatch <{object}> Whether the <{object/type}> attribute and the Content-Type value need to match for the resource to be used Boolean attribute
usemap <{img}> 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.


List of event handler content attributes
Attribute Element(s) Description Value
{{GlobalEventHandlers/onabort}} HTML elements abort event handler Event handler content attribute
onafterprint <{body}> afterprint event handler for {{Window}} object Event handler content attribute
onbeforeprint <{body}> beforeprint event handler for {{Window}} object Event handler content attribute
onbeforeunload <{body}> beforeunload event handler for {{Window}} object Event handler content attribute
onblur HTML elements blur event handler Event handler content attribute
oncancel HTML elements cancel event handler Event handler content attribute
oncanplay HTML elements canplay event handler Event handler content attribute
oncanplaythrough HTML elements canplaythrough event handler Event handler content attribute
onchange HTML elements change event handler Event handler content attribute
onclick HTML elements click event handler Event handler content attribute
onclose HTML elements close event handler Event handler content attribute
oncopy HTML elements copy event handler Event handler content attribute
oncuechange HTML elements cuechange event handler Event handler content attribute
oncut HTML elements cut event handler Event handler content attribute
ondblclick HTML elements dblclick event handler Event handler content attribute
ondrag HTML elements drag event handler Event handler content attribute
ondragend HTML elements dragend event handler Event handler content attribute
ondragenter HTML elements dragenter event handler Event handler content attribute
ondragexit HTML elements dragexit event handler Event handler content attribute
ondragleave HTML elements dragleave event handler Event handler content attribute
ondragover HTML elements dragover event handler Event handler content attribute
ondragstart HTML elements dragstart event handler Event handler content attribute
ondrop HTML elements drop event handler Event handler content attribute
ondurationchange HTML elements durationchange event handler Event handler content attribute
onended HTML elements ended event handler Event handler content attribute
onerror HTML elements error event handler Event handler content attribute
onfocus HTML elements focus event handler Event handler content attribute
onhashchange <{body}> hashchange event handler for {{Window}} object Event handler content attribute
oninput HTML elements input event handler Event handler content attribute
oninvalid HTML elements invalid event handler Event handler content attribute
onkeydown HTML elements keydown event handler Event handler content attribute
onkeypress HTML elements keypress event handler Event handler content attribute
onkeyup HTML elements keyup event handler Event handler content attribute
onlanguagechange <{body}> languagechange event handler for {{Window}} object Event handler content attribute
onload HTML elements load event handler Event handler content attribute
onloadeddata HTML elements loadeddata event handler Event handler content attribute
onloadedmetadata HTML elements loadedmetadata event handler Event handler content attribute
onloadstart HTML elements loadstart event handler Event handler content attribute
onmessage <{body}> message event handler for {{Window}} object Event handler content attribute
onmousedown HTML elements mousedown event handler Event handler content attribute
onmouseenter HTML elements mouseenter event handler Event handler content attribute
onmouseleave HTML elements mouseleave event handler Event handler content attribute
onmousemove HTML elements mousemove event handler Event handler content attribute
onmouseout HTML elements mouseout event handler Event handler content attribute
onmouseover HTML elements mouseover event handler Event handler content attribute
onmouseup HTML elements mouseup event handler Event handler content attribute
onwheel HTML elements wheel event handler Event handler content attribute
onoffline <{body}> offline event handler for {{Window}} object Event handler content attribute
ononline <{body}> online event handler for {{Window}} object Event handler content attribute
onpagehide <{body}> pagehide event handler for {{Window}} object Event handler content attribute
onpageshow <{body}> pageshow event handler for {{Window}} object Event handler content attribute
onpaste HTML elements paste event handler Event handler content attribute
onpause HTML elements pause event handler Event handler content attribute
onplay HTML elements play event handler Event handler content attribute
onplaying HTML elements playing event handler Event handler content attribute
onpopstate <{body}> popstate event handler for {{Window}} object Event handler content attribute
onprogress HTML elements progress event handler Event handler content attribute
onratechange HTML elements ratechange event handler Event handler content attribute
onreset HTML elements reset event handler Event handler content attribute
onresize HTML elements resize event handler Event handler content attribute
onscroll HTML elements scroll event handler Event handler content attribute
onseeked HTML elements seeked event handler Event handler content attribute
onseeking HTML elements seeking event handler Event handler content attribute
onselect HTML elements select event handler Event handler content attribute
onstalled HTML elements stalled event handler Event handler content attribute
onstorage <{body}> storage event handler for {{Window}} object Event handler content attribute
onsubmit HTML elements submit event handler Event handler content attribute
onsuspend HTML elements suspend event handler Event handler content attribute
ontimeupdate HTML elements timeupdate event handler Event handler content attribute
ontoggle HTML elements toggle event handler Event handler content attribute
onunload <{body}> unload event handler for {{Window}} object Event handler content attribute
onvolumechange HTML elements volumechange event handler Event handler content attribute
onwaiting HTML elements waiting event handler Event handler content attribute