HTML Global Attributes
A curated reference of 150 HTML attributes (as of October 2026): the 36 global attributes valid on any element (the WHATWG globals plus MDN-documented ones such as data-*, part, exportparts and the non-standard anchor and virtualkeyboardpolicy) plus widely-used element-specific attributes such as src, href, type, and disabled. Each record identifies which elements accept the attribute, provides a concise description of its purpose and accepted values, and flags deprecated attributes that should be avoided in new markup.
Quick fetch
Stable URL. CORS-enabled. No auth.
curl https://staticdata.dev/v1/html-attributes.json
Or use as a typed import:
import { htmlAttributes } from "https://staticdata.dev/v1/html-attributes.ts"
Formats
- JSON 36.2 KB
/v1/html-attributes.json
min: 28.9 KB · /v1/html-attributes.min.json
- CSV 20.1 KB
/v1/html-attributes.csv
- TypeScript 36.4 KB
/v1/html-attributes.ts
export const htmlAttributes
type HtmlAttribute = (typeof htmlAttributes)[number]
Schema
Each record in the dataset has the following shape.
| Field | Type | Description | Example |
|---|---|---|---|
| attribute | string | The attribute name as written in HTML markup | class |
| elements | string[] | Elements that accept this attribute; ["*"] means all elements | ["*"] |
| description | string | Description of the attribute's purpose and accepted values | A space-separated list of CSS class names to apply to the element. |
| deprecated | boolean | True if the attribute is deprecated and should not be used in new markup | false |
Preview
First 10 records.
| attribute | description | deprecated |
|---|---|---|
| accesskey | Specifies a keyboard shortcut to activate or focus an element. The value is a space-separated list of characters; the browser uses the first one it supports. | false |
| anchor | Non-standard (Chromium only): associates an element with an anchor element by ID for CSS anchor positioning. Prefer the standard anchor-name/position-anchor CSS properties. | false |
| autocapitalize | Controls whether and how text input is automatically capitalized. Values: off/none, on/sentences, words, characters. | false |
| autocorrect | Controls whether automatic spelling correction is applied while the user edits text. Values: on (default) or off. | false |
| autofocus | Indicates that an element should be focused automatically when the page loads or when a dialog is displayed. Only one element per document/dialog may have this attribute. | false |
| class | A space-separated list of CSS class names to apply to the element. Classes are used by CSS selectors and JavaScript to select elements. | false |
| contenteditable | Indicates whether the element's content is editable. Values: true (or empty string), false, plaintext-only. | false |
| data-* | Custom data attributes that store extra information on HTML elements that has no defined meaning. Any attribute starting with 'data-' followed by at least one character is a valid custom data attribute. | false |
| dir | Specifies the text directionality of the element's content. Values: ltr (left-to-right), rtl (right-to-left), auto (determined by content). | false |
| draggable | Indicates whether the element can be dragged using the HTML Drag and Drop API. Values: true, false. | false |
Fetch examples
Drop-in snippets in five languages.
curl -sSL https://staticdata.dev/v1/html-attributes.json | jq '.[0]' import type { HtmlAttribute } from "https://staticdata.dev/v1/html-attributes.ts";
const res = await fetch("https://staticdata.dev/v1/html-attributes.min.json");
if (!res.ok) throw new Error(`Fetch failed: ${res.status}`);
const htmlAttributes: HtmlAttribute[] = await res.json();
console.log(htmlAttributes[0]); import urllib.request, json
with urllib.request.urlopen("https://staticdata.dev/v1/html-attributes.min.json") as r:
htmlAttributes = json.load(r)
print(htmlAttributes[0]) package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
resp, err := http.Get("https://staticdata.dev/v1/html-attributes.min.json")
if err != nil { panic(err) }
defer resp.Body.Close()
var data []map[string]any
if err := json.NewDecoder(resp.Body).Decode(&data); err != nil {
panic(err)
}
fmt.Println(data[0])
} use serde_json::Value;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let body = ureq::get("https://staticdata.dev/v1/html-attributes.min.json").call()?.into_string()?;
let data: Vec<Value> = serde_json::from_str(&body)?;
println!("{:?}", data.first());
Ok(())
} Sources and methodology
Data is curated from the MDN Web Docs HTML Global attributes reference and the WHATWG HTML Living Standard. The dataset covers 36 global attributes that are valid on every HTML element (e.g., id, class, style, lang, hidden, data-*) as well as a selection of 114 element-specific attributes covering forms, media, tables, links, scripts, and metadata elements.
The elements field uses ["*"] to indicate attributes that are genuinely global — valid on any HTML element regardless of its tag. Element-specific attributes list the specific tags that accept them. The deprecated flag marks attributes that are retained for backwards compatibility but should not be used in new documents; CSS equivalents (such as border, bgcolor, align, color) should be preferred for styling. Newer attributes such as popover, writingsuggestions, closedby, command/commandfor and headingoffset reflect features added to the HTML standard in 2023–2025; anchor and virtualkeyboardpolicy are Chromium-only and not part of the HTML standard. Event-handler content attributes (onclick etc.) are not included.
This dataset is suitable for HTML validators, IDE auto-complete engines, documentation generators, linters, and developer education tools. Descriptions summarise the normative behaviour and note accepted values where the attribute is not boolean. For the complete normative definitions and edge cases, consult the WHATWG HTML Living Standard or MDN Web Docs.
Versioning
URLs under /v1/ are stable: field names and types will not change in a way
that breaks consumers. Values can be corrected or records added when the upstream source
changes; schema-incompatible updates ship under a new version path. See the
html-attributes changelog for this dataset's history.
Related datasets
More Web datasets
- aria-attributes
- character-encodings
- csp-directives
- credit-card-types
- dns-record-types
- emoji
- emoji-shortcodes
- html-elements
- html-entities
- input-types
- http-auth-schemes
- http-cache-directives
- http-content-codings
- http-headers
- http-methods
- http-status-codes
- http-versions
- iframe-sandbox-tokens
- ip-protocol-numbers
- keyboard-event-codes
- link-relations
- media-type-suffixes
- mime-types
- oauth-grant-types
- ports
- referrer-policies
- ip-special-blocks
- svg-elements
- tcp-flags
- tlds
- tls-cipher-suites
- tls-versions
- uri-schemes
- well-known-uris