All HTML Attributes
All HTML Attributes
accept <input> Specifies the types of files that the server accepts (only for
type="file")
accept-charset <form> Specifies the character encodings that are to be used for the
form submission
align Not supported in HTML 5. Specifies the alignment according to surrounding elements.
Use CSS instead
alt <area>, <img>, <input> Specifies an alternate text when the original element fails
to display
autofocus <button>, <input>, <select>, <textarea> Specifies that the element should automatically get focus
when the page loads
autoplay <audio>, <video> Specifies that the audio/video will start playing as soon as
it is ready
bgcolor Not supported in HTML 5. Specifies the background color of an element. Use CSS
instead
border Not supported in HTML 5. Specifies the width of the border of an element. Use CSS
instead
cite <blockquote>, <del>, <ins>, <q> Specifies a URL which explains the quote/deleted/inserted
text
class Global Attributes Specifies one or more classnames for an element (refers to
a class in a style sheet)
color Not supported in HTML 5. Specifies the text color of an element. Use CSS instead
colspan <td>, <th> Specifies the number of columns a table cell should span
content <meta> Gives the value associated with the http-equiv or name
attribute
contextmenu Global Attributes Specifies a context menu for an element. The context menu
appears when a user right-clicks on the element
controls <audio>, <video> Specifies that audio/video controls should be displayed
(such as a play/pause button etc)
data <object> Specifies the URL of the resource to be used by the object
data-* Global Attributes Used to store custom data private to the page or application
defer <script> Specifies that the script is executed when the page has
finished parsing (only for external scripts)
dir Global Attributes Specifies the text direction for the content in an element
dirname <input>, <textarea> Specifies that the text direction will be submitted
disabled <button>, <fieldset>, <input>, Specifies that the specified element/group of elements
<optgroup>, <option>, <select>, <textarea> should be disabled
download <a>, <area> Specifies that the target will be downloaded when a user
clicks on the hyperlink
dropzone Global Attributes Specifies whether the dragged data is copied, moved, or
linked, when dropped
form <button>, <fieldset>, <input>, Specifies the name of the form the element belongs to
<label>, <meter>, <object>, <output>, <select>, <textar
ea>
formaction <button>, <input> Specifies where to send the form-data when a form is
submitted. Only for type="submit"
headers <td>, <th> Specifies one or more headers cells a cell is related to
height <canvas>, <embed>, <iframe>, <img>, <input>, <object Specifies the height of the element
>, <video>
href <a>, <area>, <base>, <link> Specifies the URL of the page the link goes to
hreflang <a>, <area>, <link> Specifies the language of the linked document
label <track>, <option>, <optgroup> Specifies the title of the text track
loop <audio>, <video> Specifies that the audio/video will start over again, every
time it is finished
media <a>, <area>, <link>, <source>, <style> Specifies what media/device the linked document is
optimized for
method <form> Specifies the HTTP method to use when sending form-data
multiple <input>, <select> Specifies that a user can enter more than one value
muted <video>, <audio> Specifies that the audio output of the video should be
muted
name <button>, <fieldset>, <form>, <iframe>, <input>, <map Specifies the name of the element
>, <meta>, <object>, <output>, <param>, <select>, <tex
tarea>
novalidate <form> Specifies that the form should not be validated when
submitted
onblur All visible elements. Script to be run when the element loses focus
oncanplay <audio>, <embed>, <object>, <video> Script to be run when a file is ready to start playing (when
it has buffered enough to begin)
oncanplaythro <audio>, <video> Script to be run when a file can be played all the way to the
ugh end without pausing for buffering
onchange All visible elements. Script to be run when the value of the element is changed
onclick All visible elements. Script to be run when the element is being clicked
oncontextmen All visible elements. Script to be run when a context menu is triggered
u
oncopy All visible elements. Script to be run when the content of the element is being
copied
oncuechange <track> Script to be run when the cue changes in a <track> element
oncut All visible elements. Script to be run when the content of the element is being
cut
ondblclick All visible elements. Script to be run when the element is being double-clicked
ondrag All visible elements. Script to be run when the element is being dragged
ondragend All visible elements. Script to be run at the end of a drag operation
ondragenter All visible elements. Script to be run when an element has been dragged to a
valid drop target
ondragleave All visible elements. Script to be run when an element leaves a valid drop target
ondragover All visible elements. Script to be run when an element is being dragged over a
valid drop target
ondragstart All visible elements. Script to be run at the start of a drag operation
ondrop All visible elements. Script to be run when dragged element is being dropped
ondurationcha <audio>, <video> Script to be run when the length of the media changes
nge
onemptied <audio>, <video> Script to be run when something bad happens and the file is
suddenly unavailable (like unexpectedly disconnects)
onended <audio>, <video> Script to be run when the media has reach the end (a useful
event for messages like "thanks for listening")
onerror <audio>, <body>, <embed>, <img>, <object>, <script>, Script to be run when an error occurs
<style>, <video>
onfocus All visible elements. Script to be run when the element gets focus
onhashchange <body> Script to be run when there has been changes to the anchor
part of the a URL
oninput All visible elements. Script to be run when the element gets user input
oninvalid All visible elements. Script to be run when the element is invalid
onkeydown All visible elements. Script to be run when a user is pressing a key
onkeypress All visible elements. Script to be run when a user presses a key
onkeyup All visible elements. Script to be run when a user releases a key
onload <body>, <iframe>, <img>, <input>, <link>, <script>, <s Script to be run when the element is finished loading
tyle>
onloadedmeta <audio>, <video> Script to be run when meta data (like dimensions and
data duration) are loaded
onloadstart <audio>, <video> Script to be run just as the file begins to load before
anything is actually loaded
onmousedown All visible elements. Script to be run when a mouse button is pressed down on
an element
onmousemove All visible elements. Script to be run as long as the mouse pointer is moving
over an element
onmouseout All visible elements. Script to be run when a mouse pointer moves out of an
element
onmouseover All visible elements. Script to be run when a mouse pointer moves over an
element
onmouseup All visible elements. Script to be run when a mouse button is released over an
element
onmousewheel All visible elements. Script to be run when a mouse wheel is being scrolled over
an element
onoffline <body> Script to be run when the browser starts to work offline
ononline <body> Script to be run when the browser starts to work online
onpagehide <body> Script to be run when a user navigates away from a page
onpaste All visible elements. Script to be run when the user pastes some content in an
element
onpause <audio>, <video> Script to be run when the media is paused either by the user
or programmatically
onplay <audio>, <video> Script to be run when the media has started playing
onplaying <audio>, <video> Script to be run when the media has started playing
onprogress <audio>, <video> Script to be run when the browser is in the process of
getting the media data
onratechange <audio>, <video> Script to be run each time the playback rate changes (like
when a user switches to a slow motion or fast forward
mode).
onresize <body> Script to be run when the browser window is being resized.
onscroll All visible elements. Script to be run when an element's scrollbar is being
scrolled
onsearch <input> Script to be run when the user writes something in a search
field (for <input="search">)
onseeked <audio>, <video> Script to be run when the seeking attribute is set to false
indicating that seeking has ended
onseeking <audio>, <video> Script to be run when the seeking attribute is set to true
indicating that seeking is active
onselect All visible elements. Script to be run when the element gets selected
onstalled <audio>, <video> Script to be run when the browser is unable to fetch the
media data for whatever reason
onsuspend <audio>, <video> Script to be run when fetching the media data is stopped
before it is completely loaded for whatever reason
ontimeupdate <audio>, <video> Script to be run when the playing position has changed
(like when the user fast forwards to a different point in the
media)
ontoggle <details> Script to be run when the user opens or closes the <details>
element
onunload <body> Script to be run when a page has unloaded (or the browser
window has been closed)
onvolumechan <audio>, <video> Script to be run each time the volume of a video/audio has
ge been changed
onwaiting <audio>, <video> Script to be run when the media has paused but is expected
to resume (like when the media pauses to buffer more data)
onwheel All visible elements. Script to be run when the mouse wheel rolls up or down
over an element
open <details> Specifies that the details should be visible (open) to the
user
optimum <meter> Specifies what value is the optimal value for the gauge
placeholder <input>, <textarea> Specifies a short hint that describes the expected value of
the element
preload <audio>, <video> Specifies if and how the author thinks the audio/video
should be loaded when the page loads
required <input>, <select>, <textarea> Specifies that the element must be filled out before
submitting the form
reversed <ol> Specifies that the list order should be descending (9,8,7...)
rowspan <td>, <th> Specifies the number of rows a table cell should span
size <input>, <select> Specifies the width, in characters (for <input>) or specifies
the number of visible options (for <select>)
sizes <img>, <link>, <source> Specifies the size of the linked resource
spellcheck Global Attributes Specifies whether the element is to have its spelling and
grammar checked or not
src <audio>, <embed>, <iframe>, <img>, <input>, <script> Specifies the URL of the media file
, <source>, <track>, <video>
srcdoc <iframe> Specifies the HTML content of the page to show in the
<iframe>
srclang <track> Specifies the language of the track text data (required if
kind="subtitles")
srcset <img>, <source> Specifies the URL of the image to use in different
situations
step <input> Specifies the legal number intervals for an input field
target <a>, <area>, <base>, <form> Specifies the target for where to open the linked document
or where to submit the form
value <button>, <input>, <li>, <option>, <meter>, <progress> Specifies the value of the element
, <param>
width <canvas>, <embed>, <iframe>, <img>, <input>, <object Specifies the width of the element
>, <video>
wrap <textarea> Specifies how the text in a text area is to be wrapped when
submitted in a form