HTML Global Attributes


Attribute Description
accesskey To activate/focus an element, provide a shortcut key.
autocapitalize It is used to automatically capitalize the text entered/edited by the user.
autofocus In HTML, the autofocus attribute specifies that the element should be given focus when the page loads. It is a boolean property.
class This property specifies one or more classnames for an element (refers to a class in a style sheet).
contenteditable Specifies whether an element's content is editable or not.
contextmenu This element's contextmenu is provided by the id of a <menu>.
data-* Used to store custom data that is only available to the page or application.
dir Specifies the text direction for an element's content.
enterkeyhint It indicates what label or icon to display on a virtual keyword while pressing keys.
draggable Specifies whether or not an element is draggable.
hidden Specifies that an element is either not yet relevant or is no longer relevant.
id A unique id for an element is specified.
inputmode This property is primarily used to inform browsers about which virtual keyboard configuration to use when editing this element or its contents.
is It specifies that standard HTML behaves in the same way as a registered custom built-in element.
itemid It is a unique global identifier for an item.
itemprop It is a property that is added to an item.
itemscope It uses item types to ensure that the HTML in a block is about a specific item.
itemtype This property specifies the URL vocabulary that will be used to define itemprops.
nonce It is a cryptographic nonce ("number used once") used by a content security policy to determine whether or not a given fetch is allowed to proceed.
lang Specifies the language in which the element's content will be displayed.
part It is a space-separated list of the element's part names.
slot It is used to associate an element with a slot in a shadow DOM shadow tree.
spellcheck Specifies whether or not the element's spelling and grammar will be checked.
style Specifies an element's inline CSS style.
tabindex Specifies an element's tabbing order.
title Extra information about an element is given.
translate Specifies whether or not an element's content should be translated.

Not Supported In HTML 5

Attribute Description
align Specifies the alignment with relation to the surrounding items. Instead, use CSS.
acronym Defines an acronym
applet This class defines an embedded applet.
bgcolor Specifies the color of an element's background. Instead, use CSS.
basefont Sets the color, size, and font for all text in a document.
border Specifies the width of an element's border. Instead, use CSS.
big Defines large text.
center The definition of centered text.
color Specifies the color of an element's text. Instead, use CSS.
dir This function defines a directory list.
font Text font, color, and size are defined.
frame In a frameset, this defines a window (a frame).
frameset Defines a collection of frames.
noframes Defines an alternative content for users who do not have frames enabled.
strike Strikethrough text is defined.
tt Teletype text is defined.

All Visible Elements

Attribute Description
onblur When the element loses attention, this script will be executed.
onchange When the value of an element changes, a script is executed.
onclick When an element is clicked, a script is executed.
oncontextmenu When a context menu is activated, this script is executed.
oncopy When the element's content is copied, a script is executed.
oncut Script to be executed when the element's content is being trimmed.
ondblclick When the element is double-clicked, the script is executed.
ondrag When an element is dragged, a script is executed.
ondragend Script to be executed after the conclusion of a drag operation
ondragenter When an element is dragged to a proper drop target, this script is executed.
ondragleave When an element exists a valid drop target, this script is executed.
ondragover When an element is dragged over a valid drop target, this script is executed.
ondragstart Script that will be executed at the start of a drag operation.
ondrop When a dragged element is dropped, a script is executed.
oninput When the element is selected, the script will be executed.
oninvalid When the element is invalid, this script is executed.
onkeydown When a user presses a key, this script is executed.
onkeypress When a user touches a key, a script is executed.
onkeyup When a user releases a key, this script is executed.
onmousedown When a mouse button is pushed on an element, a script is executed.
onmousemove The script will execute as long as the mouse cursor is over an element.
onmouseout When the mouse cursor leaves an element, this script is executed.
onmouseover When the mouse cursor moves over an element, this script is executed.
onmouseup When a mouse button is released over an element, this script is executed.
onmousewheel When the mouse wheel is scrolled over an element, this script is executed.
onpaste When a user pastes material into an element, a script is executed.
onscroll When an element's scrollbar is scrolled, this script is executed.
onselect When the element is chosen, the script is executed.
onwheel When the mouse wheel moves up or down over an element, this script is executed.