Menu

List of HTML Global Attributes
Last Modified: May 09 2020

Global attributes are those that can be added to any HTML element in the DOM.

Attribute Overview
accesskey Specifies a shortcut key to activate or to give focus to an element.
<input type='email' accesskey='e' />
class Comma separated list of class names that can be used to style the element in CSS.
contenteditable Makes an element editable when given focus.
data- Custom attributes that can be used to store data directly on a DOM element.
<div data-animal-id='1'>Bird</div>
<div data-animal-id='2'>Cat</div>
dir The direction that the content will flow in an element.
This is 'right to left'
This is 'left to right'
draggable Specifies whether an element is draggable or not
<div draggable='true'>You can drag this div</div>
dropzone Specifies whether the dragged data is copied, moved, or linked, when dropped
<div dropzone='copy'>dragging data to this dropzone

will result in the data getting copied</div>
hidden This will prevent the browser from showing an element onto the page.
id A unique id for an element that can be used to target the element in CSS or JavaScript.
lang Specifies the ISO language code of the element's content.
<p lang='es'>Hola amigos!</p>
spellcheck A boolean specifying whether an element is to have its spelling and grammar checked.
style Used to add inline styles to any element.
tabindex Specifies the tabbing order of an element
title Specifies extra text about an element that usually appears in a tooltip type popup.
<p title='intro'>It was the best of times</p>
translate Specifies whether the browser should translate any given content or not.
<p translate='no'>Hello World</p>