HTML Attributes List
List of HTML Attributes specifying the tag(s) for which each attribute is used:
Attribute | Description | Used with Tag(s) |
---|---|---|
accept | Used with <input> element only. | <input> |
accept-charset | Define character encoding for form submission. | <form> |
accesskey | Keyboard shortcut to activate/focus elements. | Various |
action | Specify where form data is sent after submission. | <form> |
align | Specify alignment of text content. | Deprecated |
alt | Show/display something if primary attribute isn't displayed. | <img> , <area> |
async | Works only for external scripts (when src is present). | <script> |
autocomplete | Specify whether input field should autocomplete. | <input> |
autoplay | Audio/video should automatically start playing on page load. | <audio> , <video> |
autofocus | Element should be focused on page load. | Various |
bgcolor | Set background color of an HTML element. | Deprecated |
border | Set visible border width for elements within body. | Various |
charset | Define character encoding. | <meta> |
checked | Indicate if element should be checked on page load. | <input> |
cite | Specify URL of document explaining quotes/message. | <blockquote> , <q> |
class | Specify one or more class names for an element. | Various |
cols | Number of columns a cell should span. | <td> , <th> |
colspan | Number of columns a cell should span. | <td> , <th> |
content | Values related to http-equiv or name attribute. | <meta> |
contenteditable | Specify if content in element is editable. | Various |
controls | Boolean attribute, new in HTML5. | <audio> , <video> |
coords | Specify coordinates of an area in an image map. | <area> |
data | Specify URL of embedded file of Object. | <object> , <link> |
data-* | HTML5 attribute for custom data. | Various |
datetime | Specify date and time of inserted and deleted text. | <del> , <ins> |
default | Specify track enabled if user preferences don't suggest otherwise. | <track> |
defer | Execute when page has finished parsing. | <script> |
dir | Text direction of element content. | Various |
dirname | Enable text direction of input/textarea after form submission. | <input> , <textarea> |
disabled | Indicate if element is disabled. | Various |
download | Download element when user clicks hyperlink. | <a> , <area> |
draggable | Specify if element is draggable. | Various |
dropzone | Specify how dragged data behaves when dropped. | Various |
enctype | Data present in form, encoded when submitted to server. | <form> |
for | Used in both <label> and <output> elements. | <label> , <output> |
form | Element can contain one or more forms. | Various |
formaction | Specify where form data is sent. Called after form submission. | <button> , <input> |
headers | Specify header cells a table cell is related to. | <th> , <td> |
height | Specify height of element. | <img> , <canvas> , <iframe> |
hidden | Define visibility of elements. | Various |
high | Range where gauge value is considered high. | <meter> |
href | Specify URL of document. | <a> , <link> |
hreflang | Language for linked document. | <a> , <link> |
http-equiv | Provide header info or value of content attribute. | <meta> |
id | Used by CSS and JavaScript for specific tasks. | Various |
ismap | Boolean attribute for image maps. | <img> |
kind | Kind of track (used in <track> ). | <track> |
label | Title of Text Track, used by browser when listing available tracks. | <track> |
lang | Specify language of element content. | Various |
list | Pre-defined options for <input> to suggest user. | <input> |
loop | Restart audio/video after finishing. | <audio> , <video> |
low | Range where gauge value is considered low. | <meter> |
max | Specify maximum value of an element. | <input> , <meter> , <progress> |
maxlength | Maximum number of characters in <input> element. | <input> , <textarea> |
media | Specify media/device for linked document. | <a> , <link> , <source> , <style> |
method | HTTP method used to send data when submitting form. | <form> |
min | Specify lower bound of gauge. | <input> , <meter> , <progress> |
multiple | Allow selecting more than one value in an element. | <input> |
muted | Audio output of video is muted. | <video> |
name | Specify name for element. | Various |
novalidate | Form data shouldn't be validated when submitting form. | <form> |
onblur | Event when element loses focus. | Various |
oncopy | User copied content in an element. | Various |
oncut | User cut or deleted content in element. | Various |
onkeypress | Event when user presses a key on keyboard. | Various |
onmousedown | Order of events related to onmousedown event. | Various |
onscroll | Event works when an element's scrollbar is scrolled. | Various |
optimum | Optimal numeric value for gauge. | <meter> |
pattern | Short hint for expected value of input field/textarea. | <input> |
placeholder | Short hint for expected value of input field/textarea. | <input> , <textarea> |
readonly | Text in <input> or <textarea> is read-only. | <input> , <textarea> |
required | Input element must be filled before submitting form. | Various |
reversed | Order list in descending order instead of ascending. | <ol> |
rows | Number of visible text lines for control (rows to display). | <textarea> |
rowspan | Number of rows a cell should span. | <td> , <th> |
selected | Specify which option is selected by default. | <option> |
size | Initial width for input and number of visible rows for select. | <input> , <select> |
spellcheck | Applied to HTML forms using spellcheck attribute. | Various |
srclang | Specify language of track text. | <track> |
start | Start value for numbering individual list items. | <ol> |
step | Set discrete step size of <input> element. | <input> |
style | Three ways of implementing style in HTML. | Various |
tabindex | Navigation using Tab button. | Various |
target | Specify where linked document should open. | <a> , <form> , <base> , <area> |
title | Specify extra information about element. | Various |
translate | Specify if content of element is translated. | <body> |
value | Specify value of element it's used with. | Various |
wrap | Specify text wrapping in <textarea> when form submitted. | <textarea> |
Please note that the "Used with Tag(s)" column provides general information about the tags with which an attribute is commonly used. The list might not be exhaustive, as attributes can sometimes be used with other tags as well.