HTML attribute reference
HTML attribute reference:
Attributes |
Is used |
Description |
---|---|---|
accept |
<input> |
Specifies the type of file that the server receives. This only applies to the "file" type. |
accept-charset |
<form> |
Specifies the character encoding used to submit the form. |
accesskey |
Global attribute |
Specifies the specific shortcut key to activate / focus an element. |
action |
<Form> |
Specifies where the form information will be sent when submitting the form. |
align |
Does not support HTML (5). |
Specifies the classification / alignment of elements according to the surrounding elements. Use CSS instead. |
alt |
<area>, <img>, <input> |
Displays an alternate text if you fail to display the original element. |
async |
<script> |
Specifies that the external script will be executed asynchronously. |
autocomplete |
<form>, <input> |
Specifies whether the <form> or <input> elements will input new values from previously input values. |
autofocus |
<button>, <input>, <keygen>, <select>, <textarea> |
Specifies whether the element will automatically focus when a page is loaded. |
Autoplay |
<audio>, <video> |
Specifies whether audio / video will start playing automatically when a page is loaded. |
bgcolor |
Does not support HTML (5). |
Determines the background color of an element. Use CSS instead. |
challenge |
<keygen> |
There must be a challenge after submitting the value of the <keygen> element. |
charset |
<meta>, <script> |
Determines character encoding. |
checked |
<input> |
Specifies whether the value will be selected for the "checkbox" or "radio" type of the <input> element when the page is loaded. |
cite |
<blockquote>, <del>, <ins>, <q> |
Specifies a URL to interpret quote / deleted / inserted text. |
class |
Global attribute |
Defines one or more classes for an element. |
color |
Does not support HTML (5). |
Determines the color of the text of an element. Use CSS instead. |
cols |
<textarea> |
<textarea> Specifies the visible width of the element. |
colspan |
<td>, <th> |
Determines the number of cells in a table column. |
content |
<meta> |
Attaches values to http-equiv or name attributes. |
contenteditable |
Global attribute |
Determines whether the content of an element is editable. |
contextmenu |
Global attribute |
Specifies the contextmenu for the element. The contextmenu is displayed when the user right-clicks on an element. |
controls |
<audio>, <video> |
Displays the control panel for audio / video files (eg on / off, volume up / down, etc.). |
coords |
<area> |
Determines the coordinates of a specific area. |
data |
<object> |
Specifies the source URL for the object to use. |
data-* |
Global attribute |
Used to store custom data for web pages or applications. |
datetime |
<dale>, <ins>, <time> |
Uses to specify date and time. |
default |
<track> |
Attributes are used to set the default track of the audio / video element. |
defer |
<script> |
External script will be executed when a web page load is complete. |
dir |
Global attribute |
Sets the text direction for the content of an element. |
Dirname |
<input>, <textarea> |
Text direction is submitted with the form submission. |
Disabled |
<button>,<fieldset>, <input>, <keygen>, <optgroup>, <option>,<select>, <textarea> |
Used to disable an element or group of elements. |
download |
<a>, <area> |
When the user clicks on the hyperlink, the target will be downloaded. |
Drajnabale |
Global attribute |
Determines whether the element can be dragged. |
dropzone |
Global attribute |
Determines how many copies, transfers or links of dragged data are made when an element is dropped. |
On instipy |
<form> |
Specifies the form-data encode to be submitted to the server. It only works with method = "post". |
for |
<label>, <output> |
The form element binds the input field to the text. |
form |
<button>, <fieldset>, <input>, <keygen>, <label>, <meter>, <object>, <output>, <select>, <textarea> |
Specifies an HTML form element. |
formaction |
<button>, <input> |
When submitting a form it is used to send information differently. It only works with type = "submit". |
headers |
<td>, <th> |
Determines the relationship of content with table headers. |
Height |
<canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> |
Determines the height of an element. |
hidden |
Global attribute |
Specifies that an element no longer exists or is not relevant. |
high |
<meter> |
Refers to a range that is considered the highest value. |
href |
<a>, <area>, <base>, <link> |
Specifies the address of a link. |
hreflang |
<a>, <area>, <link> |
Determines the language of the linked document. |
http-equiv |
<meta> |
Provides an HTTP header / title for the information / value in the content attribute. |
id |
Global attribute |
Specifies a unique ID for the element. |
Ismap |
<img> |
Converts an image to a server-side image-map. |
keytype |
<keygen> |
Specifies the type of security key for a <keygen> element. |
Kind |
<track> |
Specifies the type for the text track. |
label |
<track> |
Sets the title for the text track. |
lang |
Global attribute |
Determines the language of the content of the element. |
list |
<input> |
Refers to a <datalist> element that contains predefined options for the <input> element. |
loop |
<audio>, <video> |
Determines whether audio / video will resume after the end of each year. |
low |
<meter> |
Refers to a range that is considered the lowest value. |
manifest |
<html> |
Specifies the address of the cache of the document for offline browsing. |
max |
<input>, <meter>, <progress> |
Sets the maximum value value input to the element. |
maxlength |
<input>, <textarea> |
Determines the maximum number of characters that can be written in an element. |
media |
<a>, <area>, <link>, <source>, <style> |
Optimize the linked document for any type of media / device. |
Method |
<form> |
Specifies the HTTP method when sending form data. |
min |
<input>, <mitter> |
Determines the minimum value for an element. |
multiple |
<input>, <select> |
Specifies whether the user can enter multiple values. |
muted |
<video> |
The video will not have any audio output. |
name |
<button>, <fieldset>, <form>, <iframe>, <input>, <keygen>, <map>, <meta>, <object>, <output>, <param>, <select>, <textarea> |
Sets the name for the element. |
In Novelidate |
<form> |
Determines if the form will not verify the validity of the information at the time of submission. |
onabort |
<audio>, <embed>, <img>, <object>, <video> |
Stopping before loading will make the script work. |
onafterprint |
<body> |
The script will work after the document is printed. |
onbeforeprint |
<body> |
The script will work before the document is printed. |
onbeforeunload |
<body> |
The script will work before the web page is reloaded or closed. |
onblur |
All visible elements |
The script will work if you lose focus on the element. |
oncanplay |
<audio>, <embed>, <object>, <video> |
The script will work when you are ready to run a media file. |
oncanplaythrough |
<audio>, <video> |
The script will work without any pause or buffering of any audio / video. |
onchange |
All visible elements |
The script will work if the value of the element changes. |
onclick |
All visible elements |
Once you click on the element, the script will work. |
oncontextmenu |
All visible elements |
If oncontextmenu is triggered in the browser, that is, right-clicking the mouse will make the script work. |
oncopy |
All visible elements |
The script will work when an element content is copied. |
oncuechange |
<track> |
The script will work when the cue of a <track> element is changed. |
Draw |
All visible elements |
The script will work when the content of an element is cut. |
ondblclick |
All visible elements |
The script will work when an element is double-clicked. |
ondrag |
All visible elements |
The script will work in the last stage of dragging an element. |
ondragend |
All visible elements |
The script will work when dragging on an element is finished. |
ondragenter |
All visible elements |
The script will work when an element is dragged from a valid drop target. |
ondragleave |
All visible elements |
The script will work when an element misses a valid drop target. |
ondragover |
All visible elements |
The script will work if you drag an element above a valid drop target. |
ondragstart |
All visible elements |
The script will work if you start dragging an element. |
ondrop |
All visible elements |
The script will work when an element is dragged and dropped. |
ondurationchange |
<audio>, <video> |
The script will work when any media length is changed. |
onemptied |
<audio>, <video> |
The script will work when the file is no longer available due to an error or unexpected disconnection. |
onended |
<audio>, <video> |
The script will work when the audio / video file is finished. This is an important event. Usually used to show thank you message at the end of media. |
onerror |
<audio>, <video> |
The script will work when the audio / video file is finished. This is an important event. Usually used to show thank you message at the end of media. |
onerror |
<audio>, <body>, <embed>, <img>, <object>, <script>, <style>, <video> |
The script will work if any errors occur. |
onfocus |
All visible elements |
The script will work if the element key is focused. |
onhashchange |
<body> |
The script will work when the anchor part of a link is changed. |
oninput |
All visible elements |
The script will work when the user starts inputting characters into the input field. |
oninvalid |
All visible elements |
If the element is invalid then the script will work. |
Nakedon |
All visible elements |
The script will work when the user holds down any key on the keyboard. |
onkeypress |
All visible elements |
The script works when the user presses a key on the keyboard. |
onkeyup |
All visible elements |
The script will work when the user releases a key on the keyboard. |
onload |
<body>, <iframe>, <img>, <input>, <link>, <script>, <style> |
The script will work after an element load is complete. |
onloadeddata |
<audio>, <video> |
The script will work after the media data load is complete. |
onloadedmetadata |
<audio>, <video> |
The script will work after the metadata (e.g. dimension, duration) load is complete. |
onloadstart |
<audio>, <video> |
The script will work when a file starts loading. |
onmousedown |
All visible elements |
The script will work when the mouse button is pressed on an element. |
onmousemove |
All visible elements |
The script will work when you hover the mouse pointer over an element. |
onmouseout |
All visible elements |
The script will work when the mouse pointer is moved over an element. |
onmouseover |
All visible elements |
The script will work when the mouse pointer is placed on an element. |
onmouseup |
All visible elements |
The script will work when the mouse button click is removed from the top of an element. |
onmousewheel |
All visible elements |
The script will work if all visible elements are scrolled over an element with the mouse wheel. |
onoffline |
<body> |
The script will work when the browser starts working off-line. |
ononline |
<body> |
The script will work when the browser starts working on-line. |
Opjahed |
<body> |
The script will work before the user moves from one page to another. |
onpageshow |
<body> |
The script will work when the user moves from one page to another. |
onpaste |
All visible elements |
The script will work if the user pastes some content of an element. |
onpause |
All visible elements |
The script will work if the user pastes some content of an element |
onpause |
<audio>, <video> |
The script will work if the user or program stops the media in the middle. |
onplay |
<audio>, <video> |
The script will work when the media is ready to launch. |
Applying |
<audio>, <video> |
The script will work while the media is running. |
onpopstate |
<body> |
The script will work when the history of Windows changes. |
onprogress |
<audio>, <video> |
The script works when the browser is in the process of receiving media information. |
onratechange |
<audio>, <video> |
The script will work whenever the audio / video play speed changes. |
onreset |
<form> |
The script will work when the reset button of the form is clicked. |
onresize |
<body> |
The script will work when resizing the browser window. |
onscroll |
All visible elements |
The script will work when the element's scroll bar is scrolled. |
onsearch |
<input> |
The script works when the user enters something in the search box (input = "search"). |
onseeked |
<audio>, <video> |
The script will work when an audio / video is finished (seeking / seeking). |
onseeking |
<audio>, <video> |
The script works when an audio / video is pulled (seeking / seeking). |
onselect |
All visible elements |
The script works when an element is selected. |
onshow |
<menu> |
Attributes are used to display the <menu> element in the context menu. |
onstalled |
<audio>, <video> |
The script will work when for some reason the browser fails to load the media information. |
onstorage |
<body> |
The script will work when a web storage area is updated. |
onsubmit |
<form> |
The script will work once the form is submitted. |
onsuspend |
<audio>, <video> |
The script will work if for some reason the entire media information is shut down before it is loaded. |
ontimeupdate |
<audio>, <video> |
The script will work when the audio / video playing position (rapid change at different points in the media) changes. |
ontoggle |
<details> |
The script works when the user turns the <details> element key on / off. |
onunload |
<body> |
The script works when the page reloads or closes. |
onvolumechange |
<audio>, <video> |
The script will work every time the volume of the media file changes. |
onwaiting |
<audio>, <video> |
The script will work when a media file is buffered or stopped by the user for later play. |
onwheel |
All visible elements |
The script works when the mouse wheel is scrolled over an element. |
open |
<details> |
Additional hidden information in the <details> element is displayed in the browser by default. |
optimum |
<meter> |
Specifies the best value to calculate. |
pattern |
<input> |
It is a regular expression. Which determines the pattern for the value entered in the input field. |
placeholder |
<input>, <textarea> |
Provides the user with a brief indication of the information entered. |
preload |
<audio>, <video> |
Determines whether the media file will load as soon as the web page loads. |
readonly |
<input>, <textarea> |
Element specifies readability only. |
rel |
<a>, <area>, <link> |
Specifies the relationship between the document linked to the current document. |
required |
<input>, <select>, <textarea> |
Specifies that the element must be completed before submitting the form. |
reversed |
<ol> |
Sort the lists of the order in the following order (e.g. 3, 2, 1 ...) |
rows |
<textarea> |
<textarea> Specifies the number of lines displayed in the element. |
rowspan |
<td>, <th> |
Used to combine two or more rows. |
sandbox |
<iframe> |
<iframe> adds additional restrictions to the content of the element. |
scope |
<th> |
Specifies a title for the column/row or column/row group in the table. The attribute has no visible effect on normal web browsers but can be used for screen readers. |
scoped |
<style> |
The style will only apply to the parent element of that element and the child element. It is a Boolean attribute and only supports Firefox. |
selected |
<option> |
Used to pre-select an option from the <select> element drop-down list. |
shape |
<area> |
<area> determines the shape of the element. |
size |
<input>, <select> |
Specifies the number of characters entered in the <input> element and the number of options displayed in the <select> element. |
sizes |
<link> |
Used to determine the size of the icon. It only works with the rel = "icon" attribute. |
span |
<col>, <colgroup> |
Determines how many columns the elements will work with. |
spellcheck |
Global attribute |
Used to test the spelling and grammar of the variable text. |
src |
<audio>, <embed>, <iframe>, <img>, <input>, <script>, <source>, <track>, <video> |
Specifies the media file for the media element. |
srcdoc |
<iframe> |
The <iframe> element is used to display HTML content. |
srclang |
<track> |
Defines language for audio / video track subtitles. |
start |
<ol> |
Sets the starting value of the calculated number in an order list. |
step |
<input> |
Specifies the interval between two numbers when typing numbers in an input field. |
style |
Global attribute |
Element is used to style in line. |
tabindex |
Global attribute |
The keyboard tab determines the index for the key. |
target |
<a>, <airea>, <seat>, <form> |
Determines where the linked document will open or where the form will be submitted. |
title |
Global attribute |
Provides additional information about an element. It is displayed in the browser in the form of a tooltip. |
translate |
Global attribute |
Determines whether the contents of the element will be translated. |
type |
<button>, <embed>, <input>, <link>, <menu>, <object>, <script>, <source>, <style> |
Determines the type of elements. |
usemap |
<img>, <object> |
The attribute is used to use the image / object as an image-map, i.e. to relate to the map element. |
value |
<button>, <input>, <li>, <option>, <progress>, <param> |
Determines the value of the element. |
widt |
<canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> |
Determines the width of the element. |
wrap |
<textarea> |
Determines how text will be displayed in the text-area of a submitted form. |
Attributes |
Is used |
Description |
shelleyakter
So nice post, Thank You.