Attributes add settings to an element: where a link goes, which image to load, whether a field is required. This page lists every attribute in the current HTML Living Standard , from accept to wrap, with the elements that accept it and a short description. Follow an element link for full details, allowed values and examples.
<input type ="email" name ="email" required autocomplete ="email">
A few things to keep in mind while you scan the table:
Global attributes such as class, id, hidden, lang and tabindex work on every element. They appear here marked Global , and each one is explained on the Global attributes page.
Event handler attributes (onclick, oninput, onsubmit, …) are also global. They have their own page: Event attributes .
ARIA attributes (role and aria-*) come from the WAI-ARIA specification and are covered on the ARIA reference page.
Boolean attributes (marked boolean ) are on when present and off when absent. Write disabled, not disabled="false": any value, even "false", turns the feature on.
Attributes removed from HTML, such as align, bgcolor, border and cellpadding, are not listed. Use CSS instead.
A–Z table#
Attribute
Elements
Description
abbr
<th>
A short form of the header text, which screen readers can announce instead of the full header.
accept
<input>
For type="file": a comma-separated list of file types the picker suggests, such as image/* or .pdf.
accept-charset
<form>
The character encoding used to submit the form. The only valid value today is UTF-8, which is also the default.
accesskey
Global
A keyboard shortcut hint for focusing or activating the element.
action
<form>
The URL that receives the submitted form data. Defaults to the current page.
allow
<iframe>
A permissions policy for the embedded page, for example allow="fullscreen; camera".
allowfullscreen
<iframe>
Boolean. Lets the embedded page go full screen. Older syntax; allow="fullscreen" is preferred.
alpha
<input>
Boolean, new. For type="color": lets the user pick a transparency (alpha) value too. Support is still limited.
alt
<area> , <img> , <input>
Text alternative shown or read when the image can't be seen. Use alt="" for purely decorative images. On <input>, applies to type="image".
as
<link>
With rel="preload" or rel="modulepreload": the kind of resource being fetched, such as script, style, font, image or fetch.
async
<script>
Boolean. Downloads the script in parallel and runs it as soon as it arrives, without waiting for parsing to finish.
autocapitalize
Global
Controls automatic capitalization on virtual keyboards: off, none, on, sentences, words or characters.
autocomplete
<form> , <input> , <select> , <textarea>
Tells the browser what data the field expects (email, street-address, one-time-code, …) so it can autofill, or off to discourage autofill.
autocorrect
Global
Newer. Turns automatic spelling correction on or off for editable text.
autofocus
Global
Boolean. Focuses the element when the page or dialog opens.
autoplay
<audio> , <video>
Boolean. Starts playback automatically. Most browsers allow this only for muted media.
Attribute
Elements
Description
blocking
<link> , <script> , <style>
Newer. With blocking="render", the browser waits for this resource before the first paint.
Attribute
Elements
Description
charset
<meta>
Declares the document's character encoding. The only valid value is utf-8.
checked
<input>
Boolean. Checkbox or radio button is selected when the page loads.
cite
<blockquote> , <del> , <ins> , <q>
A URL pointing to the source of the quote or to an explanation of the edit. Not shown to users.
class
Global
One or more space-separated class names, used by CSS and JavaScript.
closedby
<dialog>
New. Which user actions can close the dialog: any (light dismiss and Esc), closerequest (Esc only) or none.
color
<link>
A color used when the browser draws a site's mask icon (rel="mask-icon"). Rarely needed today.
colorspace
<input>
New. For type="color": the color space of the value, limited-srgb (default) or display-p3. Support is still limited.
cols
<textarea>
Visible width in average characters. Default 20.
colspan
<td> , <th>
How many columns the cell spans. Default 1.
command
<button>
New. The action to run on the element named by commandfor, such as show-modal, close, toggle-popover or a custom --name.
commandfor
<button>
New. The id of the element the button's command controls.
content
<meta>
The value of the metadata named by name or http-equiv.
contenteditable
Global
Makes the element's content editable: true, false or plaintext-only.
controls
<audio> , <video>
Boolean. Shows the browser's built-in playback controls.
coords
<area>
Coordinates of the clickable region in an image map; their meaning depends on shape.
crossorigin
<audio> , <img> , <link> , <script> , <video>
Fetches the resource using CORS: anonymous (no credentials) or use-credentials.
Attribute
Elements
Description
data
<object>
The URL of the resource to embed.
data-*
Global
Custom data attributes for your own scripts and styles, such as data-user-id="42".
datetime
<del> , <ins> , <time>
A machine-readable date, time or duration, such as 2026-03-01 or PT2H.
decoding
<img>
Image decoding hint: sync, async or auto.
default
<track>
Boolean. Enables this text track unless the user's preferences say otherwise.
defer
<script>
Boolean. Downloads a classic external script in parallel and runs it, in order, after the document is parsed.
dir
Global
Text direction: ltr, rtl or auto.
dirname
<input> , <textarea>
Names an extra form field that submits the text direction (ltr or rtl) of the user's input.
disabled
<button> , <fieldset> , <input> , <link> , <optgroup> , <option> , <select> , <textarea>
Boolean. Makes the control unusable and leaves it out of form submission. On <link rel="stylesheet">, turns the stylesheet off.
download
<a> , <area>
Downloads the linked resource instead of opening it. An optional value suggests a file name. Works for same-origin URLs.
draggable
Global
Whether the element can be dragged: true or false.
Attribute
Elements
Description
enctype
<form>
How POSTed data is encoded: application/x-www-form-urlencoded (default), multipart/form-data (needed for file uploads) or text/plain.
enterkeyhint
Global
Label for the Enter key on virtual keyboards: enter, done, go, next, previous, search or send.
exportparts
Global
Re-exports shadow parts of nested components so outer CSS can style them with ::part().
Attribute
Elements
Description
fetchpriority
<img> , <link> , <script>
Relative fetch priority hint: high, low or auto.
for
<label> , <output>
On <label>: the id of the control it labels. On <output>: space-separated ids of the fields the result was calculated from.
form
<button> , <fieldset> , <input> , <object> , <output> , <select> , <textarea>
The id of the form this control belongs to, even if it sits outside that form in the markup.
formaction
<button> , <input>
Overrides the form's action for this submit button.
formenctype
<button> , <input>
Overrides the form's enctype for this submit button.
formmethod
<button> , <input>
Overrides the form's method for this submit button.
formnovalidate
<button> , <input>
Boolean. Skips validation when this button submits the form (handy for "Save draft").
formtarget
<button> , <input>
Overrides the form's target for this submit button.
Attribute
Elements
Description
headers
<td> , <th>
Space-separated ids of the header cells that describe this cell, for complex tables.
height
<canvas> , <embed> , <iframe> , <img> , <input> , <object> , <source> , <video>
Height in CSS pixels (a plain number, no unit). On images and video it also reserves space before loading. On <source>, only inside <picture>.
hidden
Global
Hides the element: hidden (or hidden="hidden") or hidden="until-found".
high
<meter>
Lower bound of the "high" range of the gauge.
href
<a> , <area> , <base> , <link>
The URL of the linked resource.
hreflang
<a> , <link>
The language of the linked resource, such as fr or pt-BR.
http-equiv
<meta>
A pragma directive: content-security-policy, refresh, content-type, default-style, x-ua-compatible and a few others.
Attribute
Elements
Description
id
Global
A unique identifier for the element in the document.
imagesizes
<link>
With rel="preload" as="image": the sizes value of the image being preloaded.
imagesrcset
<link>
With rel="preload" as="image": the srcset value of the image being preloaded.
inert
Global
Boolean. Makes the element and its subtree non-interactive and hidden from assistive technology.
inputmode
Global
Which virtual keyboard to show: none, text, decimal, numeric, tel, search, email or url.
integrity
<link> , <script>
A cryptographic hash (Subresource Integrity) the fetched file must match, such as sha384-….
is
Global
Turns a built-in element into a customized built-in element. Not supported in Safari.
ismap
<img>
Boolean. Server-side image map: inside a link, sends the click coordinates to the server.
itemid
Global
Microdata: a global identifier (URL) for the item.
itemprop
Global
Microdata: the name of a property of the item.
itemref
Global
Microdata: ids of elements elsewhere that hold more properties of the item.
itemscope
Global
Boolean. Microdata: starts a new item.
itemtype
Global
Microdata: the vocabulary URL of the item, such as https://schema.org/Person.
Attribute
Elements
Description
kind
<track>
The type of text track: subtitles (default), captions, descriptions, chapters or metadata.
Attribute
Elements
Description
label
<optgroup> , <option> , <track>
A user-visible label: the group name, a shorter option text, or the track name in the media menu.
lang
Global
The language of the element's content, as a BCP 47 tag such as en, es-MX or zh-Hant.
list
<input>
The id of a <datalist> with suggested values.
loading
<iframe> , <img>
lazy delays loading until the element is near the viewport; eager (default) loads it right away.
loop
<audio> , <video>
Boolean. Restarts playback from the beginning when it ends.
low
<meter>
Upper bound of the "low" range of the gauge.
Attribute
Elements
Description
max
<input> , <meter> , <progress>
The largest allowed value (or a date/time upper limit for date inputs). On <progress>, the value that means "done".
maxlength
<input> , <textarea>
The most characters (UTF-16 code units) the user can type.
media
<link> , <meta> , <source> , <style>
A media query that says when the resource applies, such as (prefers-color-scheme: dark). On <meta>, used with name="theme-color".
method
<form>
How the form is sent: get (default), post, or dialog (closes the parent <dialog>).
min
<input> , <meter>
The smallest allowed value, or the earliest allowed date/time.
minlength
<input> , <textarea>
The fewest characters accepted when the field is not empty.
multiple
<input> , <select>
Boolean. Allows more than one value: several files, several email addresses, or several options.
muted
<audio> , <video>
Boolean. Starts the media with sound off.
Attribute
Elements
Description
name
<button> , <details> , <fieldset> , <form> , <iframe> , <input> , <map> , <meta> , <object> , <output> , <select> , <slot> , <textarea>
A name whose meaning depends on the element: the key sent with a form field, a frame target name, a metadata name, a slot name, or an exclusive group for <details> (only one in the group is open at a time).
nomodule
<script>
Boolean. Skips the script in browsers that support JavaScript modules. A fallback for very old browsers.
nonce
Global
A one-time token that lets a specific script or style pass a Content Security Policy.
novalidate
<form>
Boolean. Turns off built-in validation when the form is submitted.
Attribute
Elements
Description
open
<details> , <dialog>
Boolean. The details are expanded, or the dialog is shown. Open dialogs with show() or showModal() rather than adding this by hand.
optimum
<meter>
The best value on the gauge, which decides whether the low or high range counts as good.
Attribute
Elements
Description
part
Global
Exposes an element inside a shadow tree so outer CSS can style it with ::part().
pattern
<input>
A regular expression the whole value must match.
ping
<a> , <area>
Space-separated URLs that receive a small POST request when the link is followed.
placeholder
<input> , <textarea>
A short hint shown while the field is empty. It is not a replacement for a <label>.
playsinline
<video>
Boolean. Plays the video inside the page on mobile instead of switching to full screen.
popover
Global
Makes the element a popover: auto, manual or hint.
popovertarget
<button> , <input>
The id of the popover this button controls.
popovertargetaction
<button> , <input>
What the button does to the popover: toggle (default), show or hide.
poster
<video>
An image URL shown before the video plays.
preload
<audio> , <video>
Loading hint: none, metadata or auto.
Attribute
Elements
Description
readonly
<input> , <textarea>
Boolean. The user can't change the value, but it can be focused, selected and submitted.
referrerpolicy
<a> , <area> , <iframe> , <img> , <link> , <script>
How much referrer information to send, such as no-referrer, origin or strict-origin-when-cross-origin (the default).
rel
<a> , <area> , <form> , <link>
The relationship to the linked resource: stylesheet, icon, preload, noopener, nofollow, canonical and more.
required
<input> , <select> , <textarea>
Boolean. The field must have a value before the form can be submitted.
reversed
<ol>
Boolean. Numbers the list in descending order.
rows
<textarea>
Visible number of text lines. Default 2.
rowspan
<td> , <th>
How many rows the cell spans. 0 means "to the end of the row group".
Attribute
Elements
Description
sandbox
<iframe>
Applies extra restrictions to the embedded page. Tokens such as allow-scripts or allow-forms lift individual restrictions.
scope
<th>
Which cells the header applies to: row, col, rowgroup or colgroup.
selected
<option>
Boolean. The option is selected when the page loads.
shadowrootclonable
<template>
Boolean. A declarative shadow root that is copied when its host is cloned.
shadowrootdelegatesfocus
<template>
Boolean. Focusing the shadow host moves focus to the first focusable element inside.
shadowrootmode
<template>
Creates a declarative shadow root on the parent element: open or closed.
shadowrootserializable
<template>
Boolean. Lets getHTML() include this shadow root when serializing.
shape
<area>
The shape of an image-map region: rect, circle, poly or default.
size
<input> , <select>
On text inputs, the visible width in characters. On <select>, how many options are visible at once.
sizes
<img> , <link> , <source>
For images: the slot width at each breakpoint, so the browser can pick from srcset (auto is allowed for lazy images). On <link rel="icon">: the icon dimensions, such as 32x32 or any.
slot
Global
The name of the shadow DOM <slot> this element is placed into.
span
<col> , <colgroup>
How many columns the element covers.
spellcheck
Global
Whether the browser should check spelling: true or false.
src
<audio> , <embed> , <iframe> , <img> , <input> , <script> , <source> , <track> , <video>
The URL of the resource to load. On <input>, applies to type="image".
srcdoc
<iframe>
Inline HTML to show in the frame instead of loading src.
srclang
<track>
The language of the text track. Required for kind="subtitles".
srcset
<img> , <source>
A list of image candidates with width (800w) or density (2x) descriptors.
start
<ol>
The number the list starts counting from.
step
<input>
The allowed increment for numbers, ranges, dates and times, or any.
style
Global
Inline CSS declarations for this element.
Attribute
Elements
Description
tabindex
Global
Makes an element focusable (0), focusable only by script (-1), or sets its tab order (positive numbers, best avoided).
target
<a> , <area> , <base> , <form>
Where to open the result: _self, _blank, _parent, _top or a named frame.
title
Global
Advisory text, usually shown as a tooltip. On <abbr> and <dfn> it gives the expansion or term; on <link> and <style> it names an alternative stylesheet.
translate
Global
Whether translation tools should translate the content: yes or no.
type
<a> , <button> , <embed> , <input> , <link> , <object> , <ol> , <script> , <source>
Depends on the element: the input type (see <input> types ), the button behavior (submit, reset, button), the numbering style of a list (1, a, A, i, I), module or importmap for scripts, or the MIME type of a linked resource.
Attribute
Elements
Description
usemap
<img>
Connects the image to a <map> , written as # plus the map's name.
Attribute
Elements
Description
value
<button> , <data> , <input> , <li> , <meter> , <option> , <output> , <progress>
The element's value: what a field submits, the machine-readable value of <data>, a list item's number, or a gauge's current amount.
Attribute
Elements
Description
width
<canvas> , <embed> , <iframe> , <img> , <input> , <object> , <source> , <video>
Width in CSS pixels (a plain number, no unit). On <canvas> it sets the drawing surface size (default 300). On <source>, only inside <picture>.
wrap
<textarea>
How line breaks are submitted: soft (default, no extra breaks) or hard (inserts breaks at the visible wrap; needs cols).
writingsuggestions
Global
Newer. Turns the browser's inline writing suggestions true or false.
Attributes defined outside HTML#
A few attributes you will meet in real pages come from other specifications. They work in browsers but aren't part of the HTML standard itself.
Attribute
Elements
Defined in
Description
role
Any element
WAI-ARIA
Gives the element an accessibility role. See the ARIA reference .
aria-*
Any element
WAI-ARIA
States and properties for assistive technology, such as aria-label or aria-expanded.
on*
Any element
HTML and other specs
Event handler attributes. See Event attributes .
disablepictureinpicture
<video>
Picture-in-Picture
Boolean. Asks the browser not to offer picture-in-picture. Not supported in every browser.
disableremoteplayback
<audio> , <video>
Remote Playback
Boolean. Hides the cast or AirPlay option. Not supported in every browser.
xmlns
<html> , <svg> , <math>
XML namespaces
Allowed for compatibility, but not needed in HTML documents: the parser assigns namespaces automatically.
Example: attributes working together#
Attributes on a form field
Live
Reset
Run
< form id = " signup" >
< label for = " user" > Username</ label>
< input id = " user" name = " user" type = " text"
required minlength = " 3" maxlength = " 16"
pattern = " [a-z0-9_]+" autocomplete = " username"
placeholder = " lowercase, digits, _"
spellcheck = " false" autocapitalize = " none" >
< button> Check</ button>
</ form>
< p id = " out" > </ p>
< script>
document. getElementById ( 'signup' ) . addEventListener ( 'submit' , ( event ) => {
event. preventDefault ( ) ;
const value = event. target. user. value;
document. getElementById ( 'out' ) . textContent = ` " ${ value} " passed every rule. ` ;
} ) ;
</ script>
Try submitting an empty field, two characters, or capital letters: each attribute adds one rule, and the browser checks them all before the submit event fires.