HTML Attribute Reference


Attribute Belongs to Description
accept <input> Specifies the file types accepted by the server (only for type="file")
accept-charset <form> Specifies the character encodings to be used in form submission.
action <form> When a form is submitted, this property specifies where the form-data should be sent.
alt <area>, <img>, <input> When the original element fails to display, this property specifies an alternate text.
async <script> This specifies that the script is run asynchronously (only for external scripts).
autocomplete <form>, <input> Specifies whether autocomplete should be enabled for the <form> or <input> element.
autofocus <button>, <input>, <select>, <textarea> Specifies whether or not the element should be given focus when the page loads.
autoplay <audio>, <video> The audio/video will begin playing as soon as it is ready, according to this setting.
charset <meta>, <script> Character encoding is specified.
checked <input> When the website loads, an <input> element is pre-selected (for type="checkbox" or type="radio").
cite <blockquote>, <del>, <ins>, <q> Provides a URL that describes the quote/removed/inserted content.
cols <textarea> The amount of columns that a table cell should span.The amount of columns that a table cell should span.
colspan <td>, <th> The amount of columns that a table cell should span.
content <meta> This function returns the value associated with the http-equiv or name attribute.
controls <audio>, <video> Specifies whether audio/video controls (such as a play/pause button) should be shown.
coords <area> Specifies the area's coordinates.
data <object> Specifies the URL of the resource that the object will utilise.
datetime <del>, <ins>, <time> Sets the date and time.
default <track> Specifies that the track should be activated if the user's choices do not suggest that another track would be a better fit.
defer <script> When the page has finished processing, the script is run (only for external scripts).
dirname <input>, <textarea> The text direction will be supplied, as specified.
disabled <button>, <fieldset>, <input>, <optgroup>, <option>, <select>, <textarea> Disables the specified element/group of elements.
download <a>, <area> When a user clicks on the hyperlink, the target will be downloaded.
enctype <form> Specifies how form data should be encoded when sent to the server (only when method="post" is used).
for <label>, <output> Specifies the form element(s) to which a label/calculation is attached.
form <button>, <fieldset>, <input>, <label>, <meter>, <object>, <output>, <select>, <textarea> The name of the form to which the element belongs.
formaction <button>, <input> When a form is submitted, this property specifies where the form-data should be sent. Only when type="submit" is used.
headers <td>, <th> Specifies one or more header cells to which a cell is associated.
height <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> Specifies the element's height.
high <meter> Specifies the range of values regarded to be high.
href <a>, <area>, <base>, <link> Specifies the URL of the page to which the link leads.
hreflang <a>, <area>, <link> The language of the referenced document is specified.
http-equiv <meta> The information / value of the content property is provided in the form of an HTTP header.
ismap <img> An image is specified as a server-side image map.
kind <track> This parameter specifies the type of text track.
label <track>, <option>, <optgroup> The text track's title is specified here.
list <input> A <datalist> element containing pre-defined choices for an <input> element.
loop <audio>, <video> When the audio/video is done, it is specified that it will begin again.
low <meter> Specifies the range of values regarded to be low.
max <input>, <meter>, <progress> Sets the maximum value.
maxlength <input>, <textarea> The maximum amount of characters that can be used in an element.
media <a>, <area>, <link>, <source>, <style> Specifies the media/device for which the referenced document is optimised.
method <form> When delivering form data, this property specifies the HTTP method to use.
min <input>, <meter> Sets a minimum value.
multiple <input>, <select> Allows a user to enter more than one value.
muted <video>, <audio> Specifies that the video's audio output should be muted.
name <button>, <fieldset>, <form>, <iframe>, <input>, <map>, <meta>, <object>, <output>, <param>, <select>, <textarea> The element's name is specified.
novalidate <form> Specifies that the form should not be verified when submitted.
onabort <audio>, <embed>, <img>, <object>, <video> Script to be executed on abort
onafterprint <body> Script that will be executed when the document has been printed
onbeforeprint <body> Before printing the document, run this script.
onbeforeunload <body> Script to be executed when the document is going to be unloaded.
oncanplay <audio>, <embed>, <object>, <video> When a file is ready to play, this script is executed (when it has buffered enough to begin)
oncanplaythrough <audio>, <video> Script to execute when a file can be played all the way through without halting for buffering.
oncuechange <track> Script to be executed when the cue in a <track> element changes.
ondurationchange <audio>, <video> Script that will be executed when the duration of the media changes.
onemptied <audio>, <video> When anything catastrophic happens and the file becomes abruptly inaccessible, this script should be invoked (like unexpectedly disconnects)
onended <audio>, <video> When the media has reached its conclusion, the script will be executed (a useful event for messages like "thanks for listening")
onerror <audio>, <body>, <embed>, <img>, <object>, <script>, <style>, <video> When an error occurs, run this script.
onfocus All visible elements. When an element is selected, a script is executed.
onhashchange <body> When the anchor component of a URL changes, this script is called.
onload <body>, <iframe>, <img>, <input>, <link>, <script>, <style> When the element has finished loading, the script will be executed.
onloadeddata <audio>, <video> When media data is loaded, this script is executed.
onloadedmetadata <audio>, <video> When meta data (such as dimensions and duration) is loaded, this script is executed.
onloadstart <audio>, <video> Script to be executed soon when the file begins to load, before anything else is loaded.
onoffline <body> When the browser is offline, this script is executed.
ononline <body> When the browser connects to the internet, this script is executed.
onpagehide <body> When a user navigates away from a page, this script is executed.
onpageshow <body> When a user navigates to a page, a script is executed.
onpause <audio>, <video> When the media is paused, either by the user or programmatically, this script is executed.
onplay <audio>, <video> Script that will be executed after the media has begun to play.
onplaying <audio>, <video> Script that will be executed after the media has begun to play.
onpopstate <body> When the history of the window changes, this script is executed.
onprogress <audio>, <video> Script to be executed when the browser is retrieving media data.
onratechange <audio>, <video> Script that will be executed each time the playback rate changes (like when a user switches to a slow motion or fast forward mode).
onreset <form> When a form's reset button is pressed, this script is executed.
onresize <body> When the browser window is resized, this script is executed.
onsearch <input> When a user types something into a search field, a script is executed (for <input="search">)
onseeked <audio>, <video> When the seeking property is set to false, it indicates that the seeking process has concluded.
onseeking <audio>, <video> When the seeking property is set to true, indicating that seeking is active, this script is executed.
onstalled <audio>, <video> When the browser is unable to acquire the media data for whatever reason, this script is executed.
onstorage <body> When a Web Storage area is modified, a script is executed.
onsubmit <form> When a form is submitted, this script is executed.
onsuspend <audio>, <video> For whatever reason, the script to be launched when receiving the media data is interrupted before it is entirely loaded is terminated.
ontimeupdate <audio>, <video> When the playing position changes, this script will be executed.
ontoggle <details> When the user opens or closes the <details> element, a script is executed.
onunload <body> When a page is unloaded, this script is executed.
onvolumechange <audio>, <video> Script that will be executed each time the volume of a video/audio is altered.
onwaiting <audio>, <video> When the media has been halted but is expected to restart, run this script.
open <details> The details should be available (open) to the user, according to this setting.
optimum <meter> Specifies what value is the best for the gauge.
pattern <input> Specifies a regular expression against which the value of an <input> element is tested.
placeholder <input>, <textarea> Specifies a brief suggestion describing the element's anticipated value.
poster <video> Specifies an image to be displayed while the movie downloads or until the user presses the play button.
preload <audio>, <video> Specifies if and how the audio/video should be loaded when the page loads, according to the author.
readonly <input>, <textarea> This attribute specifies that the element is read-only.
rel <a>, <area>, <form>, <link> Describes the connection between the current and related documents.
required <input>, <select>, <textarea> Specifies that the element must be completed before the form can be submitted.
reversed <ol> Specifies that the list should be ordered descendingly (9,8,7...).
rows <textarea> Specifies the number of visible lines in a text area.
rowspan <td>, <th> The amount of rows that a table cell should span.
sandbox <iframe> Allows an additional set of constraints to be applied to the content of an <iframe>.
scope <th> Specifies whether a header cell is a column, row, or set of columns or rows' header.
selected <option> When the page loads, this property specifies that an option should be pre-selected.
shape <area> Specifies the area's shape.
size <input>, <select> Specifies the width of the input in characters (<for input>) or the number of displayed options (<for select>).
sizes <img>, <link>, <source> The size of the connected resource is specified.
span <col>, <colgroup> The number of columns to span is specified.
spellcheck Global Attributes Specifies whether or not the element's spelling and grammar will be checked.
src <audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video> Specifies the media file's URL.
srcdoc <iframe> Specifies the HTML content of the page that will be shown in the <iframe>.
srclang <track> The language of the track text data (needed if kind="subtitles").
srcset <img>, <source> Specifies the URL of the picture to be used in certain scenarios.
start <ol> The start value of an ordered list is specified.
step <input> The allowable number intervals for an input field are specified.
style Global Attributes Specifies an element's inline CSS style.
tabindex Global Attributes Specifies an element's tabbing order.
target <a>, <area>, <base>, <form> Specifies the destination for opening the linked document or submitting the form.
title Global Attributes Extra information about an element is given.
translate Global Attributes Specifies whether or not an element's content should be translated.
type <a>, <button>, <embed>, <input>, <link>, <menu>, <object>, <script>, <source>, <style> Specifies the element's type.
usemap <img>, <object> An image is specified as a client-side image map.
value <button>, <input>, <li>, <option>, <meter>, <progress>, <param> Specifies the element's value.
width <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> The width of the element is specified.
wrap <textarea> When text in a text area is submitted in a form, this property specifies how the content should be wrapped.