HTML Element Attributes
Element-specific attributes apply only to particular elements, unlike global attributes. Browse all 122 below, each with its accepted values and live examples.
| Name | Description |
|---|---|
| abbr | Gives a table header cell a short abbreviated label. |
| accept | Filters the file types a file input accepts. |
| accept-charset | Sets the character encodings a form accepts. |
| action | Sets the URL a form submits to. |
| allow | Sets a Permissions Policy for an iframe. |
| allowfullscreen | Lets an iframe go fullscreen. |
| alt | Provides alternative text for an image. |
| as | Declares the type of a preloaded resource. |
| async | Loads and runs a script asynchronously. |
| autocomplete | Controls browser autofill for a field. |
| autoplay | Starts media playback automatically. |
| blocking | Marks a resource as render-blocking. |
| buffered | Reports buffered media ranges (a JS property). |
| capture | Requests media capture from a device camera/mic. |
| charset | Declares the document character encoding. |
| checked | Pre-checks a checkbox or radio button. |
| cite | Cites the source URL of a quote or edit. |
| cols | Sets the visible width of a textarea. |
| colspan | Spans a table cell across columns. |
| command | Declares a built-in button command (invoker commands). |
| commandfor | Targets the element a button command controls. |
| content | Holds the value of a meta declaration. |
| controls | Shows native media playback controls. |
| coords | Sets the coordinates of an image-map area. |
| crossorigin | Sets the CORS mode for fetching the resource. |
| data | Sets the URL of an embedded object. |
| datetime | Gives a machine-readable date/time. |
| decoding | Hints the image decoding strategy. |
| default | Enables a media track by default. |
| defer | Defers script execution until after parsing. |
| dir | Sets the text direction of content. |
| dirname | Submits a field's text direction with the form. |
| disabled | Disables a form control. |
| download | Prompts the browser to download the linked file. |
| enctype | Sets the encoding of submitted form data. |
| fetchpriority | Hints the fetch priority of the resource. |
| for | Links a label to its form control by id. |
| form | Associates a control with a form by id. |
| formaction | Overrides the form action for one submit button. |
| formenctype | Overrides the form encoding for one button. |
| formmethod | Overrides the form method for one submit button. |
| formnovalidate | Skips validation for one submit button. |
| formtarget | Overrides the form target for one button. |
| headers | Links data cells to header cells for accessibility. |
| height | Sets the height of the element in pixels. |
| high | Sets the high boundary of a meter. |
| href | Specifies the URL a hyperlink points to. |
| hreflang | States the language of the linked document. |
| http-equiv | Defines an HTTP-header-like meta directive. |
| imagesizes | Sets the sizes hint for a preloaded image. |
| imagesrcset | Sets a responsive srcset for a preloaded image. |
| integrity | Verifies a resource against a hash (SRI). |
| ismap | Makes an image a server-side image map. |
| kind | Sets the kind of a media text track. |
| label | Labels an option group or option. |
| label | Titles a media text track. |
| list | Connects an input to a datalist of suggestions. |
| loading | Controls eager vs lazy loading of the resource. |
| loop | Replays media from the start when it ends. |
| low | Sets the low boundary of a meter. |
| max | Sets the maximum allowed value. |
| maxlength | Limits the maximum character count. |
| media | Applies the resource to matching media only. |
| method | Sets the HTTP method for form submission. |
| min | Sets the minimum allowed value. |
| minlength | Sets the minimum character count. |
| multiple | Allows multiple values or selections. |
| muted | Mutes the media by default. |
| name | Names a form control for submission. |
| name | Names a metadata value on a meta tag. |
| nomodule | Provides a fallback script for legacy browsers. |
| novalidate | Skips native form validation on submit. |
| open | Shows a details/dialog in its open state. |
| optimum | Sets the optimum value of a meter. |
| pattern | Validates input against a regular expression. |
| ping | Pings URLs when the link is clicked. |
| placeholder | Shows hint text in an empty field. |
| played | Reports played media ranges (a JS property). |
| playsinline | Plays a video inline instead of fullscreen. |
| popovertarget | Makes a button toggle a popover. |
| popovertargetaction | Sets whether a popover button shows, hides or toggles. |
| poster | Sets a placeholder image for a video. |
| preload | Hints how much media to preload. |
| readonly | Makes a field read-only. |
| referrerpolicy | Controls the Referer header sent for the request. |
| rel | Defines the relationship to the linked resource. |
| required | Marks a form control as mandatory. |
| reversed | Counts an ordered list downwards. |
| rows | Sets the visible line count of a textarea. |
| rowspan | Spans a table cell across rows. |
| sandbox | Sandboxes an iframe with opt-in permissions. |
| scope | States what a table header cell labels. |
| selected | Pre-selects a dropdown option. |
| selectionDirection | Direction of the text selection (a JS property). |
| selectionEnd | End of the text selection (a JS property). |
| selectionStart | Start of the text selection (a JS property). |
| shadowrootclonable | Makes a declarative shadow root clonable. |
| shadowrootdelegatesfocus | Delegates focus into a declarative shadow root. |
| shadowrootmode | Declares a declarative shadow root on a template. |
| shadowrootserializable | Makes a declarative shadow root serializable. |
| shape | Sets the shape of an image-map area. |
| size | Sets the visible size of the control. |
| sizes | Defines image display size for srcset selection. |
| span | Spans a col/colgroup across columns. |
| src | Specifies the URL of an embedded resource. |
| srcdoc | Supplies inline HTML for an iframe. |
| srclang | Sets the language of a media text track. |
| srcset | Lists responsive image candidates. |
| start | Sets the start number of an ordered list. |
| step | Sets the value increment for numeric/date inputs. |
| target | Specifies where to open a link or form result. |
| type | Specifies the MIME type of a resource. |
| type | Sets a button's behavior. |
| type | Sets the type of an input control. |
| type | Sets the marker style of an ordered list. |
| type | Sets the MIME type of an embedded object. |
| usemap | Links an image to a client-side image map. |
| value | Sets a control's value. |
| volume | Gets/sets media volume (a JS property). |
| width | Sets the width of the element in pixels. |
| wrap | Controls textarea line wrapping on submit. |
| xmlns | Declares an XML namespace. |