Global HTML Attributes in HTML
From the HTML cheat sheet ยท Accessibility ยท verified Jul 2026
Global HTML Attributes
Common attributes that work on any HTML element
html
<div id="unique-id">Unique identifier</div>
<div class="card highlighted">CSS classes</div>
<div data-user-id="123" data-role="admin">Custom data</div>
<div hidden>Not displayed</div>
<div contenteditable="true">Editable text</div>
<div draggable="true">Drag me</div>๐ก data-* attributes store custom data on elements โ access via element.dataset in JavaScript
โก Use hidden instead of CSS display:none when you want to toggle visibility with JS
๐ tabindex="0" makes any element focusable; tabindex="-1" makes it programmatically focusable only
๐ข The lang attribute helps screen readers pronounce content correctly โ set it on <html> at minimum
attributesdataglobal